How to install pip on a Mac
Python is a powerful, popular, and easy-to-learn computer programming language that can tackle anything from writing quick automation scripts to creating web apps to training machine-learning models.
One of the best aspects of Python is its extensive environment of various packages and libraries, managed by PyPI (Python Package Index), which currently contains over 500,000 projects.
To access all the projects within PyPI and to manage them on your Mac, you’ll need to install pip macOS manager. And there are a few ways to do that.
But first, you need to make sure that you have at least Python 3 installed, since most pip installation methods require Python 3 to work correctly.
To check your current Python version:
- Open Terminal
- Type python3 --version or python --version (it’s possible to have more than one version of Python installed)
- Press Return
If you’re using dev riddles all the time, such as converting YAML to JSON, minifying JavaScript, or converting Unix time, you need a trusty tool that can automate all that for you — DevUtils.
DevUtils solves dozens of complex conversions in one click, even down to guessing the exact utility you need ahead of time by scanning the contents of your clipboard. The best part — DevUtils works completely offline, so you can use it anytime.
Install pip on Mac for Python 3
Now that you know you have Python 3, you can proceed to pip install Mac. The recommended way to do it for Python 3.4 and later is to use the ensurepip command in your Terminal.
Here’s how to install pip with ensurepip:
- Open Terminal
- Type python3 -m ensurepip
- Press Return
However, this is not the only way to install pip macOS supports. For example, lots of users prefer using Homebrew instead.
How to use Homebrew to install pip on Mac
Homebrew is one of the most popular third-party package managers for macOS. While pip works with Python libraries, Homebrew covers everything, including C++, Ruby, Lisp, and more.
So if you have Homebrew installed already, you can install pip in a single command as well.
To install pip with Homebrew:
- Open Terminal
- Type brew install python
- Press Return
If you’re working with packages, APIs, and other documentation, you can’t expect to keep everything in your head. The key is to have a cheatsheet by your side at all times, such as Dash.
Dash is an offline manager of API documentation, featuring over 200 ready-to-use docsets and code snippets for macOS. You can even generate and keep your own docsets in there. Dash also lets you organize docsets by profile (e.g. iOS, web dev) and move around the app via shortcuts. A perfect workflow accelerator!
How to install pip manually using get-pip script
Another way to install pip that’s only available to Python 3 users is get-pip.
To install pip on Mac with get-pip:
- Open Terminal
- Type curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
- Press Return
- Wait for the script to load
- Type python3 get-pip.py
- Press Return again
How to verify pip installation
Regardless of the installation method you choose, you should quickly verify that the installation has gone correctly.
To verify pip installation:
- Open Terminal
- Type python3 -m pip --version
- Press Return
If you see an error and you did brew install pip, a common fix is to use brew unlink python && brew link python. For other fixes, try updating or uninstalling pip and repeating the steps again.
How to update pip on Mac
As any other software, pip gets updates, so it’s a good idea to try to upgrade your version if you notice a glitch or you just want to get the latest features and packages.
To update pip if you installed it via ensurepip:
- Open Terminal
- Type python3 -m ensurepip --upgrade
- Press Return
To upgrade with Homebrew, use the brew upgrade python command instead to update the Python version itself.
How to uninstall any previous installation of pip
To uninstall pip, whether you want to fix an error, use another method of pip installation, or just wish to get rid of it:
- Open Terminal
- Type pip uninstall pip
- Press Return
- Type Y to confirm
- Press Return again
Install pip on Mac for better workflow
Using pip is one of the best parts of coding in Python. It makes the language even more powerful and extensive, loading up libraries and packages that do most of the heavy lifting for you.
Similarly, you can use other apps like DevUtils for dev calculations and Dash for offline API documentations to get your work done faster.
Best of all, both apps are available to you free for seven days through the trial of Setapp. Setapp is a platform with more than 240 top-rated apps for Mac and iOS. Browse through them all and pick your new favorites today at no cost!
pip FAQs
What is pip?
pip is a package management system used for storing packages and libraries that are used with Python.
What to do if Python pip installation on Mac is not working?
Refer to the steps above for fixing and uninstalling pip, depending on which method you’ve used to install it. Then repeat the steps for installing pip on Mac one more time.