Command not found: pip
How to fix command not found pip
on Mac. For zsh or bash. Python pip install command not found. You'll see the command not found pip
error when Python is not installed or the Mac $PATH
is not set correctly.
You'll encounter the error zsh: command not found: pip
when trying to install a Python application or software library. In precise terms, this error occurs when the system's shell (zsh or bash) can't find the pip
command. Pip is the standard package manager for Python, for installing and managing software packages written in Python. Python automatically includes pip
; if Pip is not found, Python is not installed or the Mac $PATH
is not set correctly.
Before you get started
You'll need a terminal application to fix the error. Apple includes the Mac terminal but I prefer Warp Terminal. Warp is an easy-to-use terminal application, with AI assistance to help you learn and remember terminal commands. Download Warp Terminal now; it's FREE and worth a try.
Quick fix summary
If you're an experienced Python developer and you're seeing zsh: command not found: pip
on your Mac, a quick overview may be all you need to resolve it. If it is not sufficient, look below for a full details that explain how to set up Python development.
Check if Python is installed
python --version
# or
python3 --version
If Python is installed but pip isn't working:
-
Try pip3 instead:
pip3 install <package>
-
Ensure pip is installed:
python -m ensurepip --upgrade
-
Use the safer form:
python -m pip install <package>
-
Add an alias (for quick fixes only):
echo "alias pip='pip3'" >> ~/.zshrc source ~/.zshrc
If Python isn't installed:
-
For programming projects: Install Python with UV
curl -sSf https://sh.uv.dev | sh uv init myproject cd myproject uv add <package>
-
For command-line tools only: Install pipx
brew install pipx pipx ensurepath pipx install <tool-name>
Remember:
- Restart your terminal after installations
- Avoid system Python for development
- Use virtual environments for isolation
- For the most reliable approach, use
python -m pip
instead of justpip
If the above is not enough, recognize that Python tooling is complex and has evolved over time, so read carefully and take time to understand your options and the recommended practices I detail here.
What you're trying to do when you see this error
When you encounter the error zsh: command not found: pip
, you're likely trying to accomplish one of these tasks:
-
Installing a Python package or library - Most frequently, developers are running
pip install <package>
to add a specific Python library to a coding project. If you're adding a package to a project, you've probably already set up a Python development environment. -
Following tutorial or README instructions - You might be following a tutorial or README that instructs you to install dependencies (a library or software package) for a project.
-
Installing a command-line tool - Many utilities or applications like code formatters or YouTube downloaders are distributed as Python packages that must be installed via Pip.
-
Learning Python - Students often encounter this error when following tutorials or courses that assume Python is already set up and working.
-
Following installation instructions - Many tools and frameworks provide installation instructions that begin with
pip
commands, assuming the user already has a functioning Python environment. -
Setting up data science or machine learning tools - You might be trying to install packages like pandas, matplotlib, or tensorflow to start working with data or machine learning, again with the assumption the Python development environment is already set up.
The frustrating part for users is that this error occurs at the very beginning of their workflow, before they can even start the actual task they're trying to accomplish. They're essentially stuck at the starting line, which can be particularly confusing for beginners who aren't yet familiar with concepts like package managers, PATH variables, or environment management. For an explanation of the role of version management, virtual environments, and package installation in Python, see my Mac Python general guide.
Installing Python, setting up a development environment, and using Pip is complicated, especially if you're new to Python. This guide will help you fix the command not found: pip
error on macOS but first, I'll give you the background you need to understand the problem.
Why Pip is important
Python originally took a system-wide global installation approach without isolation of projects, leading to "works on my machine" problems, dependency conflicts, and upgrade hassles. Early Python development meant installing packages directly to the system Python, where conflicts between different projects' requirements were frequent and frustrating.
Unlike newer languages that integrate tools for dependency management and work with projects isolated in directories (like JavaScript with npm or Ruby with Bundler), Python initially lacked built-in tools for package management and project isolation. Python's ecosystem added these tools over time, inclduing Pip for package management and venv for virtual enviornments.
Where Pip Fits In
Pip emerged as Python's standard package installer, first introduced in 2008 as "pyinstall" before being renamed to "pip." It serves as the best-known tool for installing Python libraries from the Python Package Index (PyPI). However, Pip alone doesn't solve the isolation problem -- it simply installs packages where you tell it to.
This is why the Python ecosystem introduced additional tools to work alongside Pip:
- Virtual Environments (venv, virtualenv): Create isolated Python environments for different projects
- Requirements Files: Document dependencies with
requirements.txt
- Dependency Resolution: Tools to manage complex dependency trees (initially weak in Pip)
- Project Standardization: Tools like Poetry, Pipenv, and now UV that combine environment management with dependency handling
Python's fragmented tooling
Developers have learned to use Python's additional tools to avoid the problems of traditional Python:
- Each project gets its own virtual environment with specific dependencies
- Dependencies are explicitly declared and version-controlled
- Tools automate the creation and management of isolated environments
- Modern tools provide faster, more reliable dependency resolution
Pip is still the best-know tool for installing packages but it is now used with other tools to isolate dependencies.
When you see command not found: pip
, you're just encountering the first sign that your Python environment may not be set up correctly. Fixing the pip error is important but realize it is part of setting up the broader ecosystem of Python tools.
Is Pip what you need?
It's important to realize that pip install <package>
may not be what you actually need. Here are appropriate alternatives:
-
For standalone Python applications: Use Pipx
- Example:
pipx install youtube-dl
- Example:
-
For Python development projects: Use UV
- For new projects:
uv init myproject && cd myproject && uv add pandas
- For existing projects:
uv pip install -r requirements.txt
- For new projects:
-
For following specific tutorials: Use virtual environments with Pip
- Example:
python -m venv myenv && source myenv/bin/activate && python -m pip install requests
- Example:
Here's a full explanation:
- If you are installing a stand-alone Python program, Install Pipx and use
pipx install <package>
. Pipx (with an "x") is used to install and run Python applications in isolated environments, making it ideal for command-line utilities and standalone programs, whereas Pip (without an "x") is primarily for installing libraries within Python projects. - If you are programming in Python, use UV and install packages with
uv pip install <package>
for ad-hoc installations, or useuv init
to create a project and thenuv add <package>
for project-specific dependencies. UV sets up a better development environment, unless you really must use older Python tools (for example, if you are following a tutorial or your workplace has Python tooling rules). - If you are programming in Python and still want to use Pip, not UV, you should use a virtual environment with Venv and avoid using the "bare"
pip install <package>
command. Instead, usepython -m pip install <package>
to avoid path issues.
Using python -m pip
ensures that the pip
executable associated with the specific Python interpreter you are using is called. It means you are installing packages within the activated virtual environment rather than the global environment. This is a best practice to avoid conflicts between project dependencies. Directly calling pip
relies on the Mac PATH
to locate the pip
executable. This can lead to situations where the pip
command points to a different version of pip
than expected. By using python -m pip
, you avoid this ambiguity, ensuring the package is installed in the environment associated with the current Python interpreter.
For a guide about how to install and use Pip correctly, see my article Pip Install).
Now that you've considered alternatives to Pip, let's look at the error zsh: command not found: pip
and how to fix it.
The error zsh: command not found: pip
This is the error you'll see:
$ pip install <package>
zsh: command not found: pip
You'll see zsh: command not found: pip
because you are trying to run the Pip package manager in the terminal. The error message shows that the Zsh shell ("the command line interpreter") cannot find the Python command.
If you see an error that begins with bash...
you are using the Bash shell.
$ pip install ...
bash: command not found: pip
If you are using the Bash shell, you likely have an older version of the macOS. Check macOS and update macOS and switch to the Zsh shell.
Fix error zsh: command not found: pip
Things to try:
- Depending on your needs, you may need to install Pipx.
- You may need to restart your Terminal ("reset the shell").
- If a system Python is installed but not in the
$PATH
, you can aliaspip
. - If a newer Python version is installed but not in the
$PATH
, you can set the$PATH
. - You may need to install Python.
Do you need Pipx?
Pipx is a tool to install and run stand-alone Python applications, utilities, or tools. There are a growing number of stand-alone programs that require Python to run, such as Youtube-dl, a command-line utility to download videos from YouTube. In addition to stand-alone Python programs, Python programming tools, such as Ruff, a Python code formatter, should be installed with Pipx.
If you are only installing a Python program, and you are not developing new software in Python, see our guide:
If you are programming in Python, and trying to install a software library, read on to fix the zsh: command not found: pip
error.
Restart your Terminal
Just to be sure, quit the Terminal application and launch the Terminal again. Then try:
$ pip --version
It's an obvious solution but worth trying. A restart should display the Pip version number.
If you still see zsh: command not found: pip
, read on.
Is the system Python installed?
Try pip3 --version
and which -a pip3
to check if Python was installed with Xcode Command Line Tools.
$ pip3 --version
pip 21.2.4 from /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/site-packages/pip (python 3.9)
$ which -a pip3
/usr/bin/pip3
If you see /Library/Developer/CommandLineTools/Library/Frameworks/Python3...
, you have the system Python (and Pip) installed by Xcode Command Line Tools. If you are programming in Python, don't use the system Python. Instead, install another version of Python (see Mac Python and set the Mac PATH.
If you just want to run Python scripts or command-line utilities, you can alias the pip
command to pip3
to install packages (but it's better to Install Pipx). Add the following line to your .zshrc
file. See the article alias python3 to python for more information:
alias pip='pip3'
For this change to take effect, you'll either need to restart your terminal or reload your .zshrc
file by entering source ~/.zshrc
.
Check if Python is installed
Check if Python is installed with python --version
.
$ python --version
Python 3.13.3
Pip is installed automatically with Python, so it's unusual to run the command python
successfully and then run pip
and see zsh: command not found: pip
. If you have Python installed, you should be able to run the pip
command.
If you can run the command python
but not pip
, you can try a special command that installs Pip:
$ python -m ensurepip --upgrade
This command will install Pip if it is not already installed, but otherwise does nothing. If Pip is already installed, you'll see the message Requirement already satisfied: pip in ...
.
Setting the $PATH
for Python
If you check for Python with python --version
and you get the error zsh: command not found: python
, either Python is not installed or the $PATH
is not set correctly.
To troubleshoot, see my guide:
If you have Python installed, you need to set the $PATH
for Python. The $PATH
is an environment variable that tells the shell where to find the Python command.
How you set the $PATH
variable will depend on how you installed Python. You may have installed Python with Homebrew, with Pyenv, the official Python installer, with UV, or other methods. In the guide, you'll find instructions to set the $PATH
for various ways you may have installed Python.
Adjusting the $PATH
for Python will also allow you to run the pip
command because Pip is installed with Python. Note that adjusting the $PATH
for Python helps you set up your system for installing libraries and programming. If you are using Pipx to install and run Python programs, but not programming with Python, you don't need to set the $PATH
for Python, but you will need to set the $PATH
for Pipx.
If Python is not installed
If you've checked for Python and you are sure it was not previously installed, or if you only have the system Python that comes with Xcode Command Line Tools, and you want to start programming in Python, you can read the guide Mac Python about your options for installing Python. I suggest to install Python with UV for a fast, reliable tool to manage Python dependencies and virtual environments. With UV, you won't use pip install <package>
; instead you can use uv pip install <package>
or initialize a project with uv init myproject
and use uv add <package>
. UV is significantly faster than pip and provides better dependency resolution for both beginners and experienced Python programmers.
What's next
My mac.install.guide is a trusted source of installation guides for professional developers. Take a look at the Mac Install Guide home page for tips and trends and see what to install next.