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?

21 Answers 21

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 python -m ensurepip

This will create a similar install to what easy_install would.

  • Thanks this helped me the above approaches was giving some errors. – Feru Dec 10 '16 at 21:45
  • Perfect! My system could not locate easy-install, so the other solutions did not work. – user3235770 Mar 26 '17 at 17:54
  • This worked from behind a firewall where the others failed. Thanks! – Floris Jun 28 '17 at 23:18
  • 1
    @MattSephton the reason -H is necessary when using pip (as far as I understand) is to ensure the right user owns the cache directory. – felixphew Feb 1 at 4:53
  • 1
    This helps if you have multiple versions of python, and need a specific one to get pip. – Teepeemm Feb 6 at 2:53

⚡️ TL;DR — One line solution.

All you have to do is:

sudo easy_install pip

Complimentary GIF.

Install PIP on Mac


⚡️ 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.


P.S. I ended up blogging a post about it. QuickTip: How Do I Install pip on macOS or OS X?

  • 1
    Python comes with OS X. – Corey Goldberg Jan 17 '17 at 3:23
  • Excellent answer. Worked smoothly and in seconds. – alxfyv Mar 5 '17 at 7:09
  • unrelated, but what oh-my-zsh theme is that? it looks like agnoster but there isn't the annoying prefix, its just an arrow – Ronak Shah Mar 5 '17 at 21:37
  • 1
    Thanks one of the easiest way. Appeciate your help. – Jashan PJ Dec 13 '17 at 17:22
  • 1
    Why would you post a gif of typing in command line commands? It's both annoying and time-consuming to try to figure out what content is in there. Also what do you mean "complementary"? Would you somehow charge for it? Also, what additional information does your blog post contain or is it just advertisement? – xaxxon Jan 31 at 10:45

Somehow easy install doesn't work on my old mac (10.8). This solve my problem.

wget https://bootstrap.pypa.io/get-pip.py
sudo python get-pip.py

If you do not have wget, just open in browser https://bootstrap.pypa.io/get-pip.py then save as get-pip.py

On the recent version (from Yosemite or El Capitan I believe... at least from Sierra onward), you need to run brew postinstall python3 after brew install python3 if you use homebrew.


brew install python3 # this only installs python
brew postinstall python3 # this installs pip
  • 3
    Didn't work for me. I'm on Sierra. After doing those commands, it looked successful, but then -bash: pip: command not found. What did work for me was the top answer: sudo easy_install pip – iamse7en Dec 1 '17 at 19:59
  • @iamse7en Did you restart Terminal or open another tab? What is the log after the postinstall command? – Blaszard Dec 2 '17 at 12:46
  • FWIW - I also had the pip: command not found message. I did try to open a new tab in iTerm and had the same message. No errors on either brew command. – domdambrogia Dec 19 '17 at 3:34

all these answers make use of sudo, and then you end up with all these problems when you try to install packages globally.

Instead install pip in your /usr/local folder like this:

curl https://bootstrap.pypa.io/get-pip.py > get-pip.py
python get-pip.py --prefix=/usr/local/

and then:

pip install <package-of-choice> without sudo

  • It works!! Thank you so much!! – Haozhe Xie Dec 31 '17 at 5:33

For those who has both python2 & python3 installed, here's the solution:

python2.7 -m ensurepip --default-pip

  • 2
    this needs to be the accepted answer for recent pythons, so that people stop doing the old silly stuff – ccpizza Oct 6 '17 at 6:24

If you want "pip3" you can do the ff:

via brew: brew install python3

enter image description here

then you can execute

pip3 <command> [options]

NEW 2016 December: This worked for me on OS X v10.11 (El Capitan):

Mac comes with python 2, but not with pip.




  1. curl -O https://bootstrap.pypa.io/get-pip.py

  2. sudo python get-pip.py

With this I got these errors (but I've solved them in step 3):

The directory '/Users/myuser/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.

The directory '/Users/myuser/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.

  1. pip install --upgrade pip

Finally you can install an app like:

  1. pip install couchapp

UPDATE: Python 3

If you install python 3, pip will be installed automatically.

brew install python3

You need only to upgrade pip, but before that you need create a virtual environment to work with Python 3. You can use a project folder or any folder:

python3 -m venv venv
source venv/bin/activate
pip install --upgrade pip

Check the versions:

pip -V
python --version

To deactivate the environment:

$ deactivate
  • For me, sudo python get_pip.py worked well, cause on OS X python is already installed! – Abhishek Ghosh Dec 17 '16 at 20:10
  • This may be an option to go with if you want to use a newer version of Python since Macs default install of Python is 2.7.x. You would do this by changing step 2 above to python3 instead of python. Additional note, the brew install of python will also install pip, and provide info on upgrading/uisng pip. – Delicia Brummitt Dec 18 '16 at 16:52
  • @DeliciaBrummitt i've corrected my answer in accordance to your suggestion, and I've added a new block for python3 – stackdave Dec 25 '16 at 2:09
  • curl -O https://bootstrap.pypa.io/get-pip.py | sudo python3 get-pip.py for Python3 on El Capitan. – marw Jan 9 '17 at 19:58

Install python3 first, then use pip3 to install packages.

brew install python

python3 will be installed, and pip is shipped with it. To use pip to install some package, run the following

pip3 install package

Notice it's pip3 because you want to use python3.

On Mac:

  1. Install easy_install

    curl https://bootstrap.pypa.io/ez_setup.py -o - | sudo python
  2. Install pip

    sudo easy_install pip
  3. Now, you could install external modules. For example

    pip install regex   # This is only an example for installing other modules
  • Above solutions all yielded DistributionNotFound exceptions. This worked perfectly. – stuckj Oct 20 '15 at 21:15
  • 2
    Upvote +1000, this is so simple its not even funny. How this info is not more readily available is crazy. Other guides include compiling other libraries from source to give you access to other libraries to get you to a point where you can download.... blah blah blah. THANK YOU – dudewad Apr 14 '16 at 20:11
  • 2
    The latest OSX is already bundled with easy_install and calling curl https://bootstrap.pypa.io/ez_setup.py -o - | sudo python will break your setup! Don't install easy_setup if you already have it, I've spent an hour to repair my setup after this command (thanks to stackoverflow.com/questions/6012246/…). – Serg Nov 25 '16 at 9:16
  • 1
    Downvoting for piping curl directly into an interpreter... common as this practice is, it's something I don't like the security implications of. (Also, I think there are better answers for this question.) – lindes Dec 23 '16 at 19:54
  • 2
    easy_install is already available on macOS. – Ahmad Awais Feb 7 '17 at 8:56

I recommend Anaconda to you. It`s the leading open data science platform powered by Python. There are many basic packages installed.

  • 2
    Not related to the question – Don P Dec 6 '16 at 0:25
  • 1
    Kindly tried to address the answer correctly. – hepidad Dec 27 '16 at 22:11
  • @DonnyP Actually, this suggestion addresses the question and would expeditiously solve the original problem as it comes with pip. This answer should be promoted and encouraged. – pylang Jan 18 '17 at 20:32
  • this is not an answer this is an advertisement. If I'm mistaken the author should provide more details on how this addresses the question. – Emil Reña Enriquez Aug 14 '17 at 3:30

Installing a separate copy of Python is a popular option, even though Python already comes with MacOS. You take on the responsibility to make sure you're using the copy of Python you intend. But, the benefits are having the latest Python release and some protection from hosing your system if things go badly wrong.

To install Python using HomeBrew:

brew update
brew install python # or brew install python3

Now confirm that we're working with our newly installed Python:

ls -lh `which python`

...should show a symbolic link to a path with "Cellar" in it like:

lrwxr-xr-x  1 chris  admin    35B Dec  2 13:40 /usr/local/bin/python -> ../Cellar/python/2.7.8_2/bin/python

Pip should be installed along with Python. You might want to upgrade it by typing:

pip install --upgrade pip

Now you're ready to install any of the 50,000+ packages on PyPI.

Other Notes

Formerly, I've used get-pip.py to install pip. But, the docs warn that get-pip.py does not coordinate with package managers and may leave your system in an inconsistent state. Anyway, there's no need, given that pip is now included with Python as of 2.7.9.

Note that pip isn't the only package manager for Python. There's also easy_install. It's no good to mix the two, so don't do it.

Finally, if you have both Python 2 and 3 installed, pip will point to whichever Python you installed last. Get in the habit of explicitly using either pip2 or pip3, so you're sure which Python is getting the new library.

Happy hacking!

  • actually, python symlinks to python2, and python3 symlinks to python3... regardless of which was installed last. – Corey Goldberg Jan 17 '17 at 3:34

Download python setup tools from the below website:


Use the tar file.

Once you download, go to the downloaded folder and run

python setup.py install

Once you do that,you will have easy_install.

Use the below then to install pip:

sudo easy_install pip

You can install it through Homebrew on OS X. Why would you install Python with Homebrew?

The version of Python that ships with OS X is great for learning but it’s not good for development. The version shipped with OS X may be out of date from the official current Python release, which is considered the stable production version. (source)

Homebrew is something of a package manager for OS X. Find more details on the Homebrew page. Once Homebrew is installed, run the following to install the latest Python, Pip & Setuptools:

brew install python
  • 2
    The folder /usr/local/bin/pip was in path but pip wasn't running. I deleted the folder and reinstalled it and now it runs. Thanks !! – discipulus Sep 19 '13 at 8:58
  • 73
    You can also just sudo easy_install pip if all you want is pip on stock Python. – Jamie Schembri Sep 21 '13 at 11:27
  • 14
    Note that if you use homebrew, then you end up using your own python, not the system one. This is the road to hell if you want to use wxpython ... – GreenAsJade Nov 10 '13 at 3:09
  • 3
    I like this solution as "sudo" is not required. Let's not stuff around with the system's python. – justrhysism Apr 17 '15 at 5:30
  • 56
    If you brew-install Python, but pip is still not in your path, you might need to re-link, like this brew unlink python && brew link python – Christian Long Aug 17 '17 at 2:25

pip is available on OS X via easy_install.
Open a terminal and type:

sudo easy_install pip

When prompted for a password enter your normal login password.
After the installation has completed you should be able to use pip as expected.

note: this works for other python packages too

  • this worked for me! OSX 10.9.5, Python 2.7 – agentv Jan 24 '15 at 18:22
  • This one line fixed pip on my Mac when all I got before was some kind of DistributionNotFound exception trying to install something via pip. (Mac OS X 10.10.4, Python 2.7) – Oliver Schafeld Jul 3 '15 at 20:59
  • I had to also then run pip install --upgrade pip – thorr18 Jan 20 '16 at 4:48
  • Is pip depended on python version? I installed python3, but this command seems to be using python2. pip is installed successfully, though. – Felix Jun 19 '17 at 7:46

You should install Brew first:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Then brew install Python

brew install python

Then pip will work

  • 7
    But - you have not installed pip in the system python in this case, rather you have installed a new python and pip along with it. Then you will be into all sorts of strife trying to use wxpython... – GreenAsJade Nov 10 '13 at 3:10
  • 3
    I think the link should now be raw.github.com/mxcl/homebrew/go/install – Steve Bennett ㄹ Nov 26 '13 at 2:49

Download this file: get-pip.py

Then simply type

sudo python get-pip.py

Make sure you are on the same directory as get-pip.py or you supply the correct path for that file.

For details, you can visit: http://pip.readthedocs.org/en/latest/installing.html

or, http://thegauraw.tumblr.com/post/47601704154/how-to-install-pip-in-both-windows-ubuntu-easiest-way

To install or upgrade pip, download get-pip.py from http://www.pip-installer.org/en/latest/installing.html

Then run the following: sudo python get-pip.py

For example:

sudo python Desktop/get-pip.py 
  Downloading/unpacking pip
  Downloading pip-1.5.2-py2.py3-none-any.whl (1.2MB): 1.2MB downloaded
Installing collected packages: pip
Successfully installed pip
Cleaning up...

sudo pip install pymongo
Downloading/unpacking pymongo
  Downloading pymongo-2.6.3.tar.gz (324kB): 324kB downloaded
  Running setup.py (path:/private/var/folders/0c/jb79t3bx7cz6h7p71ydhwb_m0000gn/T/pip_build_goker/pymongo/setup.py) egg_info for package pymongo

Installing collected packages: pymongo
  • 1
    Yes, but there are simpler methods – ultimatetechie Apr 10 '14 at 6:24
  • get-pip.py is about as simple as it gets – Corey Goldberg Jan 17 '17 at 3:35

The simplest solution is to follow the installation instruction from pip's home site.

Basically, this consists in:

  • downloading get-pip.py. Be sure to do this by following a trusted link since you will have to run the script as root.
  • call sudo python get-pip.py

The main advantage of that solution is that it install pip for the python version that has been used to run get-pip.py, which means that if you use the default OS X installation of python to run get-pip.py you will install pip for the python install from the system.

Most solutions that use a package manager (homebrew or macport) on OS X create a redundant installation of python in the environment of the package manager which can create inconsistencies in your system since, depending on what you are doing, you may call one installation of python instead of another.

  • 1
    @Wesley How did you get that second installation? If you are using a python version manager there should be an option to set the python version you want and then you should be able to install pip for that specific version via the method above. – Jorge Bucaran Feb 22 '15 at 8:05
  • 1
    I does not install the pip command, see github.com/pypa/pip/issues/3027 – sorin Aug 13 '15 at 11:12
  • 1
    It is unsecure, because you run get-pip.py under sudo, but you can't guarantee that you downloaded proper get-pip.py until you know checksum. More on this: stackoverflow.com/questions/34587473/… – Vladimir Ignatyev Jan 4 '16 at 13:06
  • 1
    It looks like the linked page has moved to pip.pypa.io/en/stable/installing which mentions "Warning! Be cautious if you're using a Python install that's managed by your operating system or another package manager. get-pip.py does not coordinate with those tools, and may leave your system in an inconsistent state." – Taylor Edmiston Aug 9 '17 at 19:13
  • 1
    That warning is confusing to me because using the git-pip.py script to install pip for Apple's stock python is the main use case for the script existing vs just installing python via homebrew. – Taylor Edmiston Aug 9 '17 at 19:14
$ sudo port install py27-pip

Then update your PATH to include py27-pip bin directory (you can add this in ~/.bash_profile PATH=/opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin:$PATH

pip will be available in new terminal window.

  • port is not installed by default – Parag Magunia Dec 1 '15 at 21:08
  • 1
    @PMagunia nor is brew, not ruby – mcantsin Dec 2 '15 at 16:45

All you need to do is

sudo easy_install pip
  • 16
    If you are behind a proxy, make sure http_proxy and https_proxy are set correctly, then use the '-E' option with sudo: sudo -E easy_install pip – Neil Schaper Aug 4 '14 at 20:10
  • 14
    Installed /Library/Python/2.7/site-packages/pip-6.0.6-py2.7.egg -- what about my python3 installation? Does this just mean that pip uses my python2 installation? – Aerovistae Jan 8 '15 at 22:37
  • 25
    An extra warning: don't run this when a homebrew based python installed and occurs earlier in PATH (e.g. when you change /etc/paths): it would install pip with root credentials for the wrong python – acidjunk Jan 7 '16 at 13:56
  • 13
    Works for macOS Sierra, 10.12. – Nigel Tufnel Oct 11 '16 at 19:44
  • 2
    @the-system please to be accepting an answer. – Metagrapher Dec 2 '16 at 18:40

protected by Community Apr 23 '15 at 18:03

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.