How do I install pip on macOS or OS X?

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:

xcode-select --install

Watch a course Python - The Practical Guide

  1. Once the command line tools are installed, run the following command to install pip:
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:
pip install numpy

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