How to Install Pip on Mac

September 28, 2021

Introduction

Pip is a package management system used for installing and managing Python software packages and libraries. The software and libraries are stored in a repository called the Python Package Index (PyPI).

In this tutorial, you will learn to install pip on macOS using three methods.

How to install pip on your macOS.

Prerequisites

  • A system running macOS
  • Python installed
  • A user account with administrator-level privileges

Install Pip on macOS via get-pip.py

The get-pip.py method installs pip via the command line. The script automatically downloads and installs the pip package for Python.

Important: Install pip via get-pip.py only with Python3 or later. This method doesn't work for earlier versions. Learn how to upgrade to Python3.

Follow the steps below to install Pip:

1. Press Command + Space Bar and type in Terminal. Click the app icon to open a new terminal window.

2. Check your Python version to make sure Python3 is installed:

python3 --version
Check Python version on macOS.

3. Download pip by running the following command:

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

The curl command allows you to specify a direct download link. Use the -o option to set the name of the downloaded file.

Download pip via the get-pip.py script.

4. Install the downloaded package by running:

python3 get-pip.py
Install pip via get-pip.py.

Wait for the installation to finish. Now you have successfully installed pip on your Mac.

Install Pip on macOS via easy_install

The easy_install method features a Python module bundled with setuptools for managing Python packages. easy_install was the default Python package manager before pip.

Warning: easy_install has been deprecated and may result in a broken installation. The recommended method to use is get-pip.py or ensurepip. Also, do not use this command for a homebrew-based Python installation and prevent installing pip with root credentials for the wrong Python.

Open a terminal window and run the following command to install pip via easy_install:

sudo easy_install pip
Install pip via easy_install on macOS.

Enter your administrator password and wait for the installation to finish.

Install Pip on macOS via brew

Another method to install pip on macOS is through Homebrew, an open-source package manager.

Make sure you have Homebrew installed by running the following command:

brew install python
Install pip on macOS using Homebrew.

The command installs the latest Python, pip, and setuptools.

Note: If pip is still not in your path after installing via brew, the solution is to re-link. Run brew unlink python && brew link python.

Since macOS already comes with Python preinstalled, the command installs a separate copy of Python. Having a separate installation has several benefits:

  • The Python2 version shipped with macOS is out of date compared to the latest official Python3 release.
  • Having a separate Python version adds a layer of protection to your system.

Install via ensurepip

Since version 3.4, Python can install pip with no external commands or internet connection needed.

Open a terminal and run the following command to install pip via ensurepip:

python3 -m ensurepip --upgrade
Install pip via ensurepip on macOS.

The ensurepip command creates a similar pip installation to easy_install.

Verify Pip Installation

To verify that you have installed pip correctly, check the pip version on your system.

Open the terminal and enter:

pip --version
Verify your pip installation on macOS.

The output shows which pip version you have on your computer.

Conclusion

You should now have a working Pip installation on your Mac. Pip is a great way to manage and install packages, with over 50,000 packages available in its repository.

If you want to install Pip on a different system, read our tutorials to learn how to Install pip on Windows, Install pip on CentOS 7, Install pip on CentOS 8, Install pip on Debian 9, or Install pip on Ubuntu.

Was this article helpful?
YesNo
Bosko Marijan
Having worked as an educator and content writer, combined with his lifelong passion for all things high-tech, Bosko strives to simplify intricate concepts and make them user-friendly. That has led him to technical writing at PhoenixNAP, where he continues his mission of spreading knowledge.
Next you should read
How to Get the Current Date and Time in Python
August 14, 2019

The article shows you how to create a basic Python script that displays the current date and time. Find out how to use the strftime() method and the datetime module to format the information you need.
Read more
Python Data Types
April 1, 2021

Every programming language has their own set of built-in data types. In Python, data types provide information about a variable and what operations it supports. Learn about each data type in Python through examples.
Read more
Python SciPy Tutorial - A Guide for Beginners
February 25, 2021

When NumPy is not enough, SciPy has you covered. SciPy is a Python library used for scientific computing. It includes advanced computation algorithms performed at lightning speed. Learn how to use it through examples.
Read more
Best Python IDEs And Code Editors
January 14, 2021

An IDE is like a toolbox and a Code editor is like a power tool. In this article, we review 9 IDEs and 5 Code editors for Python. Discover the best one for you.
Read more