How to Fix 'zsh: command not found: pod' Error on macOS Catalina 10.15 After CocoaPods Installation
If you’re an iOS or macOS developer, you’ve likely encountered CocoaPods—the popular dependency manager for Swift and Objective-C projects. However, macOS Catalina (10.15) introduced changes that can trip up even experienced developers, especially with the switch from bash to zsh as the default shell. A common frustration is seeing the error zsh: command not found: podafter installing CocoaPods, even though you followed the official installation steps.
This guide will demystify why this error occurs and walk you through step-by-step solutions to resolve it. By the end, you’ll have pod recognized in your zsh terminal, allowing you to manage dependencies seamlessly.
The zsh: command not found: pod error arises because the zsh shell cannot locate the pod executable, even though CocoaPods is installed. Here’s why this happens on macOS Catalina:
macOS Catalina replaced bash with zsh as the default shell. Unlike bash (which uses .bash_profile or .bashrc), zsh relies on .zshrc for environment variables like PATH. If CocoaPods is installed to a directory not listed in zsh’s PATH, the shell won’t find pod.
CocoaPods is installed via RubyGems (gem install cocoapods). By default, RubyGems installs executables (like pod) to a "bin" directory specific to your Ruby version (e.g., /Users/yourname/.gem/ruby/2.6.0/bin). If this directory isn’t in zsh’s PATH, pod remains invisible.
macOS Catalina enforces System Integrity Protection (SIP), which limits write access to system directories. This means installing gems with sudo (e.g., sudo gem install cocoapods) may place pod in restricted locations (e.g., /usr/bin) that zsh can’t access without proper configuration.
macOS Catalina ships with Ruby 2.6.3 (system Ruby), but it’s often outdated. If you installed Ruby via Homebrew or version managers like rbenv, the gem path may differ from the system default, leading to PATH mismatches.
If you used sudo gem install cocoapods initially, you may have installed pod to a restricted system directory. Reinstalling without sudo places it in your user directory (safer and easier to manage).
The zsh: command not found: pod error in macOS Catalina is almost always due to zsh not recognizing the path to the pod executable. By adding the RubyGems bin directory to zsh’s PATH, reinstalling CocoaPods without sudo, or using Homebrew Ruby, you can resolve this quickly.
For long-term stability, we recommend Method 3 (Homebrew Ruby), as it avoids system Ruby limitations and simplifies path management.