Install pip on macOS

Choose a user-managed Python installation, verify the matching pip, and install project dependencies in a virtual environment.

Best practices
Illustration of concurrent tasks following separate paths

A normal Homebrew or python.org Python installation includes pip. Start by checking the interpreter you intend to use:

python3 --version
python3 -m pip --version

Using python3 -m pip ties pip to that interpreter instead of whichever standalone pip executable appears first on your PATH.

Install with Homebrew

If you already use Homebrew:

brew install python
python3 -m pip --version

Homebrew's usual prefix is /opt/homebrew on Apple Silicon and /usr/local on Intel Macs. Follow its shell setup instructions and use brew info python for the actual executable paths. Do not assume that a pre-existing python3 command now points to the newly installed interpreter.

Homebrew manages the Python and pip it provides. Use Homebrew to update that installation, and put project packages in virtual environments.

Use the python.org installer

Download a supported macOS installer from Python's official downloads. Complete the installer instructions, including the supplied Install Certificates.command in the versioned Applications folder. That script sets up the installation's certificate trust material; it is not a reason to disable HTTPS verification when a request fails.

The python.org installation can coexist with an Apple-managed interpreter. Leave /usr/bin/python3 and Apple/Xcode-managed files alone.

If your own Python is missing pip

For a self-managed Python that provides ensurepip:

python3 -m ensurepip --upgrade

This bootstraps the bundled pip without downloading it. It is not a universal repair for distribution-managed Python, an omitted ensurepip module, or an externally managed base environment. Repair those installations through their distributor instead.

Create a project environment

python3 -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install requests

The upgrade here affects the virtual environment's pip. If Homebrew reports an externally managed environment, use this workflow rather than overriding the protection. For standalone Python command-line tools, brew install pipx followed by pipx install TOOL_NAME creates isolated application environments.

Common questions

pip, pip3, and versioned pip commands are executable names; they do not guarantee which interpreter owns them. Inspect python3 -m pip --version and, when necessary, python3 -c 'import sys; print(sys.executable)'.

On Apple Silicon, check that Python and native dependencies use the intended architecture. A package with native extensions needs a compatible wheel for the Python version, ABI, and platform or a working source-build toolchain. Upgrading pip can improve wheel support but cannot create an unpublished wheel.

References: Python on macOS and Homebrew runtime and package guidance.

Related reading

Get a tailored plan

Contact us

Join the community

Scan with WeChat
to join the community

Try Guance

Start online and pay only for what you use.

Get started

Choose a Guance plan

Code hosting