W3docs

How do I install pip on macOS or OS X?

To install pip on macOS or OS X, you need to use the Terminal.

To install pip on macOS or OS X, you need to use the Terminal. Here's how:

  1. Open the Terminal by going to "Applications" > "Utilities" > "Terminal".
  2. Run the following command to install Xcode's command line tools:

install Xcode's command line tools

xcode-select --install

<div class="alert alert-info flex not-prose"> Watch a course <span class="hidden md:block">Watch a video course </span> Python - The Practical Guide</div>

  1. Once the command line tools are installed, run the following command to install pip:

install pip using Python

python -m ensurepip --upgrade
  1. You can now use pip to install Python packages. For example, to install the "numpy" package, run the following command:

install numpy usin pip

pip install numpy

That's it! You should now have pip installed on your macOS or OS X machine.