zsh: command not found: pip on Mac — Fix It
In this article
The fix is almost always to use pip3 (or python3 -m pip) instead of pip, because macOS ships Python 3 without a plain pip command on your PATH. If you want a bare pip, install Python 3 with Homebrew and add its bin directory to your zsh PATH, or run python3 -m ensurepip --upgrade and then call python3 -m pip. Below are the exact steps, plus what to do when the error persists.
What You'll Need
- A Mac running zsh (the default login shell since macOS Catalina). Check with
echo $SHELL; if it prints/bin/zsh, you are set. - Terminal access (Applications > Utilities > Terminal, or Spotlight search for Terminal).
- Your user password, in case a command needs
sudo(rarely needed for pip itself). - Optional: Homebrew installed, if you prefer a clean, updatable Python. Install it from brew.sh using the official one-line installer; do not use third-party scripts.
Step-by-Step
- Confirm which Python you have. Run
python3 --version. macOS includes a Python 3 install, but Apple does not put apipshim on your PATH. If the command prints a version like 3.9 or newer, skip to step 2. If it says command not found, install Python from python.org (the official macOS installer) or with Homebrew:brew install python. - Try the module form first. Run
python3 -m pip --version. This is the most reliable way to reach pip on macOS because it uses the interpreter you already have. If it prints a pip version and a Python path, you have pip — you just do not have the short command. Usepython3 -m pip install <package>from now on, or continue to step 3 to get a plainpip. - Bootstrap pip if the module form fails. Run
python3 -m ensurepip --upgrade. This installs pip into the current Python 3 environment. Then re-check withpython3 -m pip --version. If ensurepip is missing (some minimal installs strip it), reinstall Python from python.org or Homebrew rather than hunting for workarounds. - Find where pip actually lives. Run
python3 -m site --user-baseand note the path (usually/Users/yourname/Library/Python/3.x). The pip scripts sit in itsbinsubfolder. Runls ~/Library/Python/*/binto see whetherpip3(and sometimespip) is there. - Add that folder to your zsh PATH. Open
~/.zshrcin a text editor (for examplenano ~/.zshrc) and add a line likeexport PATH="$HOME/Library/Python/3.9/bin:$PATH", adjusting 3.9 to your version from step 4. Save, then runsource ~/.zshrc. Test withpip3 --version. Note that menu and file names can differ slightly by macOS version, but the~/.zshrcfile is the standard zsh startup file. - Prefer Homebrew for a bare
pip. If you installed Python via Homebrew, its binaries live in/opt/homebrew/binon Apple silicon or/usr/local/binon Intel Macs. Homebrew normally adds these to your PATH automatically. Runbrew --prefixto confirm the location, then checkls $(brew --prefix)/bin/pip*. If the files exist but the command is not found, add the bin directory to~/.zshrcthe same way as step 5. - Verify the right pip is being used. Run
which -a pip pip3. You want the first result to point at the Python you intend to use. If it points somewhere unexpected (an old framework build, a conda environment, or a pyenv shim), reorder your PATH or deactivate the environment and try again. - Install packages the safe way. Use
python3 -m pip install --user <package>for user-level installs, or a virtual environment:python3 -m venv ~/venvs/myenv, thensource ~/venvs/myenv/bin/activate. Inside an activated venv,pipandpip3both work without touching system Python. Avoidsudo pip install; it writes into system locations and can break macOS tooling.
Common Mistakes
- Typing
pipwhen onlypip3exists. On macOS, Python 3 installs usually providepip3, notpip. That is by design, not a broken install. - Editing the wrong shell file. If you add PATH lines to
~/.bash_profilewhile running zsh, nothing changes. Use~/.zshrcand reload it withsource ~/.zshrc. - Using
sudo pip. It can install packages into protected system directories and cause permission errors later. Use--useror a virtual environment instead. - Assuming the error means Python is missing. Run
python3 --versionfirst; the interpreter is often present while the pip shim is not on PATH. - Mixing Homebrew Python and Apple Python. Installing with one and running with the other produces confusing “command not found” or missing-module errors. Check
which python3and keep one toolchain per project.
Tips
- Use
python3 -m pipin scripts and documentation; it always targets the interpreter you named and avoids PATH ambiguity. - Create a virtual environment per project so pip installs stay isolated and do not require PATH edits.
- After changing
~/.zshrc, open a new Terminal window or runsource ~/.zshrc; existing windows keep the old PATH. - Run
brew doctorif Homebrew-installed tools are not found; it flags PATH and permission problems. - Keep pip current with
python3 -m pip install --upgrade pipinside the environment you use.
Troubleshooting
Still “command not found” after editing ~/.zshrc? Run echo $PATH and confirm your new directory appears. If it does not, check for typos, ensure the line is not commented out, and confirm the file is ~/.zshrc (not ~/.zprofile unless your setup uses it).
python3 -m pip says “No module named pip”? Run python3 -m ensurepip --upgrade. If that also fails, reinstall Python from python.org or Homebrew; do not download pip scripts from unofficial mirrors.
Permission denied during install? Add --user to the install command, or work inside a virtual environment. Avoid sudo unless you fully understand which interpreter is being modified.
Wrong pip version or packages missing after install? Run which -a pip pip3 python3 to see the order. Deactivate any conda or pyenv environment, then retry. If you use multiple Python installs, decide which one owns your project and call it explicitly.
Homebrew command not found after install? Follow Homebrew's own printed instructions to add its shell environment to your PATH, then restart Terminal. Do not copy PATH lines from random guides; use the path brew --prefix reports.
Frequently Asked Questions
Why does macOS say pip is not found when Python is installed?
Apple ships Python 3 without a plain pip command on your PATH. The interpreter is present, but you are expected to use pip3 or python3 -m pip.
Is pip3 the same as pip?
Functionally yes — both are pip entry points. The name difference helps keep Python 2 and Python 3 tooling separate on systems that have both.
Can I just create a symlink from pip to pip3?
You can, but it is fragile: the link can break when Python is upgraded and may point at the wrong interpreter. Using python3 -m pip or a virtual environment is safer.
Do I need Homebrew to use pip on a Mac?
No. The Python from python.org and the system Python 3 both support python3 -m pip. Homebrew simply gives you an easily updatable Python with its own bin directory.
Will installing packages with pip break macOS?
Installing into system Python with sudo can interfere with Apple-provided tools. Use --user installs or virtual environments to keep changes contained.
How do I check which pip I am running?
Run which -a pip pip3 and python3 -m pip --version. The version line shows the Python path pip belongs to.