Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

zsh: command not found: pip on Mac — Fix It

· 6 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

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

  1. Confirm which Python you have. Run python3 --version. macOS includes a Python 3 install, but Apple does not put a pip shim 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.
  2. 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. Use python3 -m pip install <package> from now on, or continue to step 3 to get a plain pip.
  3. Bootstrap pip if the module form fails. Run python3 -m ensurepip --upgrade. This installs pip into the current Python 3 environment. Then re-check with python3 -m pip --version. If ensurepip is missing (some minimal installs strip it), reinstall Python from python.org or Homebrew rather than hunting for workarounds.
  4. Find where pip actually lives. Run python3 -m site --user-base and note the path (usually /Users/yourname/Library/Python/3.x). The pip scripts sit in its bin subfolder. Run ls ~/Library/Python/*/bin to see whether pip3 (and sometimes pip) is there.
  5. Add that folder to your zsh PATH. Open ~/.zshrc in a text editor (for example nano ~/.zshrc) and add a line like export PATH="$HOME/Library/Python/3.9/bin:$PATH", adjusting 3.9 to your version from step 4. Save, then run source ~/.zshrc. Test with pip3 --version. Note that menu and file names can differ slightly by macOS version, but the ~/.zshrc file is the standard zsh startup file.
  6. Prefer Homebrew for a bare pip. If you installed Python via Homebrew, its binaries live in /opt/homebrew/bin on Apple silicon or /usr/local/bin on Intel Macs. Homebrew normally adds these to your PATH automatically. Run brew --prefix to confirm the location, then check ls $(brew --prefix)/bin/pip*. If the files exist but the command is not found, add the bin directory to ~/.zshrc the same way as step 5.
  7. 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.
  8. 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, then source ~/venvs/myenv/bin/activate. Inside an activated venv, pip and pip3 both work without touching system Python. Avoid sudo pip install; it writes into system locations and can break macOS tooling.

Common Mistakes

  • Typing pip when only pip3 exists. On macOS, Python 3 installs usually provide pip3, not pip. That is by design, not a broken install.
  • Editing the wrong shell file. If you add PATH lines to ~/.bash_profile while running zsh, nothing changes. Use ~/.zshrc and reload it with source ~/.zshrc.
  • Using sudo pip. It can install packages into protected system directories and cause permission errors later. Use --user or a virtual environment instead.
  • Assuming the error means Python is missing. Run python3 --version first; 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 python3 and keep one toolchain per project.

Tips

  • Use python3 -m pip in 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 run source ~/.zshrc; existing windows keep the old PATH.
  • Run brew doctor if Homebrew-installed tools are not found; it flags PATH and permission problems.
  • Keep pip current with python3 -m pip install --upgrade pip inside 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.