pip Command Not Found on Mac: Quick Fix Guide
In this article
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 --versionin Terminal. - Your user password if you need to install system-wide packages with Homebrew.
Step-by-Step
- 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. - 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 thepipcommand is not on your PATH. You can usepython3 -m pipfor every pip command from now on, or continue to the next step to fix the short command. - 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 runpython3 -m pip install --upgrade pipto make sure you have a current version. - 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 thebinfolder inside that path. Note the exact path shown, because it is specific to your Python version. - 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
~/.zshrcwith a text editor such as nano:nano ~/.zshrc. Add a line likeexport PATH="$HOME/Library/Python/3.x/bin:$PATH", replacing 3.x with the version from the previous step. Save the file and reload it withsource ~/.zshrc. If you use bash, the file is usually~/.bash_profileinstead. Labels and file names can differ slightly by macOS version and shell configuration. - Test the short command. Run
pip --version. If it prints a version and path, the fix is complete. If it still fails, runwhich pipto see whether the shell finds anything, and compare that with the path you added. - 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 withsource venv/bin/activate. Inside an activated environment,pipandpythonpoint to that environment, which avoids PATH conflicts between projects.
Common Mistakes
- Typing
pipwhen onlypip3is installed. On many Macs the Python 3 installer createspip3but notpip. Trypip3 --versionbefore changing anything. - Editing the wrong shell file. Adding a PATH line to
~/.bash_profilehas no effect if your Terminal is running zsh. Check your shell withecho $SHELLand 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
sourceon 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 --versionfirst so you fix the right problem.
Tips
- Prefer
python3 -m pipin 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 pythonplaces apip3command 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
pipcommand unambiguous while the environment is active. - Run
echo $PATHto 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-nameso files go to your user directory. - pip runs but installs to the wrong Python. Run
python3 -m pip --versionand compare the path it reports with the output ofwhich 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.