Python

Written & tested for accuracy by a developer (not AI)

Install Pip on Mac

How to install Pip on a Mac. Why Pip already comes with Python, how to check, how to repair a missing Pip, and how to install Python packages without breaking things.

Pip is the package manager for Python. It downloads software libraries ("packages") from the Python Package Index and installs them so your own code can use them, much as npm does for JavaScript or gem for Ruby.

You almost certainly do not need to install Pip. Every Python since version 3.4 ships with it. If you have Python on your Mac, you have Pip. Check with one command:

$ python3 -m pip --version
pip 26.0 from /opt/homebrew/lib/python3.14/site-packages/pip (python 3.14)

If that shows a version, Pip is installed and you are done. What matters then is using it without breaking things, covered in "Use Pip in a virtual environment" below, which is the part that actually trips people up.

If it errors, you have one of two problems, and neither is solved by installing pip:

  • No module named pip means Python is installed but its Pip is missing. Repair it with ensurepip, below.
  • command not found: python3 means you do not have Python yet. Install Python and Pip comes with it.

Installing Pip is one step in setting up your Mac for development. See the full Mac setup roadmap.

Before you get started

You'll need a terminal application to use Pip or Python. Apple includes the Mac terminal but I prefer Warp Terminal. Warp increases developer productivity, helping you remember easily-forgotten commands and adds AI troubleshooting. Download Warp Terminal now; it's FREE and worth a try.

Repair a missing Pip

Python bundles a module whose only job is to reinstall Pip. Use it rather than downloading anything:

$ python3 -m ensurepip --upgrade

The ensurepip module has been part of the standard library since Python 3.4, so this works on any Python you should be using. Then upgrade Pip itself:

$ python3 -m pip install --upgrade pip

If ensurepip is also missing, your Python installation is incomplete, which happens with some stripped-down or system Pythons. Rather than repair it, install a proper Python: see How to Install Python on Mac.

Why pip might not be found even though it exists

A very common case: python3 -m pip works but plain pip does not. That is a PATH issue, not a missing Pip.

$ which -a pip pip3

Using python3 -m pip instead of pip is the more reliable habit anyway. It guarantees you are using the Pip belonging to the Python you think you are using, which matters as soon as you have more than one Python installed.

Use Pip in a virtual environment

Here is the part that matters more than installation. If you run pip install <package> directly, modern Python will refuse:

error: externally-managed-environment

That is not a bug. Python implements PEP 668 to stop you from installing packages into a Python that macOS or Homebrew manages, because doing so breaks things that are hard to un-break. The fix is a virtual environment: an isolated directory holding one project's packages.

$ python3 -m venv .venv
$ source .venv/bin/activate
$ pip install requests
$ deactivate

Once activated, pip install puts packages inside .venv/ instead of your system Python, and two projects needing different versions of the same library stop fighting each other.

Pip is often the wrong tool

Before reaching for Pip, check whether you want one of the other two tools. Python splits packages into two kinds, and they need different handling:

  • Libraries you import in your own code, such as requests
  • Applications you run from the command line, such as Ruff or Youtube-dl

Three questions settle which tool you want:

  1. Are you installing a command-line application? If yes, use Pipx, or uv tool install if you already have uv. You are done.
  2. If not, are you working on a coding project? If you are not, you probably do not need to install anything at all.
  3. Do you want a single unified tool? If yes, use uv, which is the recommendation for most people. If you would rather use the traditional Python tools, pair Pip with Venv.

If you are installing an application

Pipx installs Python applications in isolated environments while keeping them available everywhere, similar to how Homebrew works but for Python command-line tools. If you are following a README that says pip install ruff, you can usually substitute pipx install ruff and avoid the whole problem.

If you are writing code

uv replaces Pip, Venv, and Pyenv with one tool, creates a virtual environment per project automatically, and is dramatically faster.

$ uv init
$ uv add requests

Which tool should you use?

Match the job to a tool:

  • uv is best for development packages. It uses pyproject.toml, has built-in virtual environments, is very fast, and has a low learning curve.
  • Pipx is best for command-line applications. It needs no dependency file, has built-in isolation, is medium speed, and has a very low learning curve.
  • Pip with Venv is best for following older tutorials. It uses requirements.txt, needs manual virtual environments, is slow, and has a medium learning curve.
  • Conda is best for scientific packages with non-Python dependencies. It uses environment.yml, has built-in environments, is slow, and has a high learning curve.

Other alternatives worth knowing: Poetry for dependency resolution and publishing or Pipenv for combined environment and dependency management.

Dependency files

Pip lists packages in a requirements.txt. Newer tools use pyproject.toml, the file that plays the role of Node's package.json, Ruby's Gemfile, or Rust's Cargo.toml. One practical difference: updating a package with pip does not necessarily update its dependencies, which is a common source of conflicts.

If you have used Node, pip is roughly npm, except that npm install installs into the project by default, while pip install installs into the shared Python unless you are in a virtual environment. That single difference explains most Python packaging confusion.

Common errors

Continue setting up your Mac

Don't miss the full visual roadmap and checklist that shows how to set up a Mac for software development, with all the essential tools and settings you might not yet know about.