Pip is a package management system used to manage packages or 3rd party modules in the Python programming language. The pip provides a very easy way to search, install, update, remove Python packages and 3rd party modules. The pip uses the Python Package Index
project as a package repository. macOS operating systems can install and use the pip for Python package management.
Install Pip On MacOS with get-pip.py File
The get-pip.py
file can be used to install pip command on MacOS. The get-pip.py file is a Python script file that contains instructions to install pip command automatically. First, we download the get-pip.py file via browser or command-line interface via the following URL.
https://bootstrap.pypa.io/get-pip.py -o get-pip.py
For example curl command can be used to download the get-pip.py file like below.
$ wget https://bootstrap.pypa.io/get-pip.py -o get-pip.py
If you prefer wget command to download files use the following line.
$ wget https://bootstrap.pypa.io/get-pip.py -o get-pip.py
After the download is complete use the pytho3
command in order to execute the get-pip.py script like below. This installs pip or pip3 command.
$ python3 get-pip.py
Install Pip On MacOS with easy_install
Python provides the easi_install
module which is bundled with the setuptools
which is created for managing Python packages. Actually the easy_install way the package management tool before the pip command. So we can use the easy_install in order to install pip command. The easy_install is very easy as its name. We only provide the pip as a package name to install it.
$ sudo easy_install pip
Install Pip On MacOS with brew
Similar to the Unix and Linux-based operating systems MacOS provides the brew
command-line package manager. The pip is provided with the python package which can be installed with the brew command.
$ brew install python
Install Pip On MacOS with ensurepip
Python provides the offline version of the pip command by default after version 3.4. The ensurepip
command can be used to install the pip without any internet connection or download like below. The ensurepip is provided as a module and used like below to install pip.
$ python3 -m ensurepip --upgrade
Verify Pip Installation
After installing the pip we can check the installation with the pip command by providing the --version
option like below.
$ pip --version

From the output, we can see that the install pip command version is 20.3.4
located under /usr/lib/python3/dist-packages/pip
. We can also see that the pip installation is related to Python version 3.9.