How do I install pip on macOS or OS X?
pip's documentation lists the supported mechanisms to install it: https://pip.pypa.io/en/stable/installation/#supported-methods
It is generally recommended to avoid installing pip on the OS-provided python
commands, and to install Python via the https://python.org 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 get-pip.py
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
⚡️ TL;DR — One line solution.
All you have to do is:
sudo easy_install pip
2019: ⚠️
easy_install
has been deprecated. Check Method #2 below for preferred installation!
Details:
⚡️ OK, I read the solutions given above, but here's an EASY solution to install
pip
.
MacOS comes with Python
installed. But to make sure that you have Python
installed open the terminal and run the following command.
python --version
If this command returns a version number that means Python
exists. Which also means that you already have access to easy_install
considering you are using macOS/OSX
.
ℹ️ Now, all you have to do is run the following command.
sudo easy_install pip
After that, pip
will be installed and you'll be able to use it for installing other packages.
Let me know if you have any problems installing pip
this way.
Cheers!
P.S. I ended up blogging a post about it. QuickTip: How Do I Install pip on macOS or OS X?
✅ UPDATE (Jan 2019): METHOD #2: Two line solution —
easy_install
has been deprecated. Please use get-pip.py
instead.
First of all download the get-pip
file
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
Now run this file to install pip
python get-pip.py
That should do it.
Another gif you said? Here ya go!
I'm surprised no-one has mentioned this - since 2013, python itself is capable of installing pip
, no external commands (and no internet connection) required.
sudo -H python -m ensurepip
This will create a similar install to what easy_install
would.