Python – How to install pip on macOS or OS X


I spent most of the day yesterday searching for a clear answer for installing pip (package manager for Python). I can't find a good solution.

How do I install it?

Best Solution

pip's documentation lists the supported mechanisms to install it:

It is generally recommended to avoid installing pip on the OS-provided python commands, and to install Python via the installers or using something like Homebrew or pyenv.

Python 3.4+ will have ensurepip, so if you're unable to run python3 -m pip -- run python3 -m ensurepip and it'll install pip for you.

If you're using an end-of-life version of Python, you can use instead.

Old answer (outdated, and results in a broken installation)

easy_install pip

If you need admin privileges to run this, try:

sudo easy_install pip