Smart Systems for Home

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

pip Command Not Found on Mac: Quick Fix Guide

· 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 "command not found: pip" error on a Mac means the shell cannot locate a pip executable in your PATH. The fastest fix is to call pip through the Python interpreter that is already installed, for example python3 -m pip --version, then install or repair pip for that Python installation and make sure its scripts folder is on your PATH. macOS does not ship pip as a standalone command by default, so this is expected rather than a broken Mac.

What You'll Need

  • A Mac running a current version of macOS.
  • Access to the Terminal app (Applications > Utilities > Terminal).
  • Python 3 installed, either from python.org or through Homebrew. If you are unsure, run python3 --version in Terminal.
  • Your user password if you need to install system-wide packages with Homebrew.

Step-by-Step

  1. Confirm which Python you have. Open Terminal and run python3 --version. If you see a version number such as Python 3.x, Python 3 is present. If the command itself is not found, install Python 3 from python.org or with Homebrew (brew install python) before continuing.
  2. Check whether pip works as a module. Run python3 -m pip --version. If this prints a pip version and a path, pip is installed and the only problem is that the pip command is not on your PATH. You can use python3 -m pip for every pip command from now on, or continue to the next step to fix the short command.
  3. Install or upgrade pip for your Python. If the module check failed, run python3 -m ensurepip --upgrade. This uses the standard library's bundled installer to put pip in place for that interpreter. Then run python3 -m pip install --upgrade pip to make sure you have a current version.
  4. Find where pip's scripts live. Run python3 -m site --user-base. This prints your user base directory, usually something like /Users/yourname/Library/Python/3.x. pip installs user-level scripts into the bin folder inside that path. Note the exact path shown, because it is specific to your Python version.
  5. Add that bin folder to your PATH. The shell reads your PATH from a startup file. On current macOS the default shell is zsh, so edit ~/.zshrc with a text editor such as nano: nano ~/.zshrc. Add a line like export PATH="$HOME/Library/Python/3.x/bin:$PATH", replacing 3.x with the version from the previous step. Save the file and reload it with source ~/.zshrc. If you use bash, the file is usually ~/.bash_profile instead. Labels and file names can differ slightly by macOS version and shell configuration.
  6. Test the short command. Run pip --version. If it prints a version and path, the fix is complete. If it still fails, run which pip to see whether the shell finds anything, and compare that with the path you added.
  7. Use a virtual environment for projects. Rather than installing everything into your user account, create a project folder and run python3 -m venv venv, then activate it with source venv/bin/activate. Inside an activated environment, pip and python point to that environment, which avoids PATH conflicts between projects.

Common Mistakes

  • Typing pip when only pip3 is installed. On many Macs the Python 3 installer creates pip3 but not pip. Try pip3 --version before changing anything.
  • Editing the wrong shell file. Adding a PATH line to ~/.bash_profile has no effect if your Terminal is running zsh. Check your shell with echo $SHELL and edit the matching startup file.
  • Using the system Python. macOS includes a Python installation intended for Apple's own tools, and installing packages into it can cause permission errors or interfere with system software. Prefer a python.org or Homebrew Python, or a virtual environment.
  • Forgetting to reload the shell. After editing a startup file, open a new Terminal window or run source on the file. Otherwise the old PATH is still active.
  • Assuming the error means Python is missing. The error is about the pip command, not Python. Check python3 --version first so you fix the right problem.

Tips

  • Prefer python3 -m pip in scripts and documentation. It always targets the same interpreter you invoked, which prevents installing a package into one Python while running your code with another.
  • Keep pip current with python3 -m pip install --upgrade pip. Older pip versions can fail on newer package formats.
  • If you use Homebrew, installing Python with brew install python places a pip3 command in Homebrew's bin directory, which is normally already on your PATH.
  • Use one virtual environment per project. It keeps dependencies separate and makes the pip command unambiguous while the environment is active.
  • Run echo $PATH to see the current search order. The folder containing pip must appear before any other folder that might contain a different pip.

Troubleshooting

  • "pip: command not found" after editing PATH. Confirm the path you added actually exists by listing it with ls. A typo in the Python version number is a common cause.
  • Permission denied when installing packages. This usually means you are installing into a location your user cannot write to. Use a virtual environment, or install with python3 -m pip install --user package-name so files go to your user directory.
  • pip runs but installs to the wrong Python. Run python3 -m pip --version and compare the path it reports with the output of which python3. If they point to different installations, use the module form consistently or adjust your PATH order.
  • ensurepip fails. Some minimal Python builds omit the bundled pip. In that case install pip using the official get-pip instructions for your Python version, or reinstall Python from python.org, which includes pip.
  • Multiple Python versions installed. Homebrew, python.org and Xcode can each provide a Python. Decide which one you want, then make sure its bin folder comes first in PATH and use its module form for pip commands.

Frequently Asked Questions

Why does macOS say pip is not found when Python is installed?

macOS does not add pip's scripts folder to your PATH by default, and some installers create pip3 rather than pip. Calling python3 -m pip works without any PATH changes.

Is pip3 the same as pip?

They are the same tool. The name depends on how Python was installed. On many Macs pip3 exists while pip does not, so try pip3 --version before troubleshooting further.

Can I use pip without changing my PATH?

Yes. Run python3 -m pip install package-name. This always uses the pip belonging to that Python interpreter and avoids PATH issues entirely.

Should I install packages with sudo?

No. Using sudo with pip can write files owned by root into your user or system directories and cause permission problems later. Use a virtual environment or the --user flag instead.

How do I know which Python pip is using?

Run python3 -m pip --version. The output includes the path to the pip module, which shows the Python installation it belongs to. Compare that with which python3.

Does reinstalling Python fix the pip command?

Often yes, because the official python.org installer includes pip and places it alongside the interpreter. After reinstalling, open a new Terminal window and test python3 -m pip --version before assuming the short command will work.