What pip is and why you need it on Mac
Pip is the package manager for Python — it downloads and installs libraries and tools that your Python code depends on, the way Homebrew installs command-line programs. When you write Python code that uses a library like Requests (for web requests) or NumPy (for math), pip is what fetches that library from the internet and puts it where Python can find it.
Mac comes with Python built in, but it does not come with pip pre-installed on all versions, and the Python version that ships with Mac is often outdated. The cleanest path is to install a current Python version using Homebrew, which automatically includes pip, or to install Python directly from python.org. Both methods take about five minutes.
If you already have Python on your Mac and are not sure whether pip is there, you can check by opening Terminal and typing pip3 --version. If you see a version number, pip is installed. If you see "command not found", follow one of the two methods below.
Key Takeaways
- The fastest way to get pip on Mac is to install Python using Homebrew, which includes pip automatically.
- If you do not have Homebrew, you can download Python directly from python.org and pip will be included in that installation.
- After installation, verify pip works by typing pip3 --version in Terminal and checking that you see a version number.
- Once pip is installed, you use it from Terminal to download libraries — for example, pip3 install requests downloads the Requests library.
Installing Python and pip using Homebrew
If you already have Homebrew on your Mac, this is the fastest route. Open Terminal (find it in Applications > Utilities or search for it with Spotlight) and type:
brew install python3
Homebrew downloads and installs the latest Python version, and pip comes with it. When the installation finishes, verify it worked by typing:
pip3 --version
You should see output like "pip 24.0 from /usr/local/lib/python3.11/site-packages/pip (python 3.11)". The exact version number does not matter — you just need to see that pip is there.
If you do not have Homebrew yet, you can install it first by pasting this into Terminal (it is a single line):
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Homebrew will walk you through the rest. Once it finishes, run the brew install python3 command above.
Installing Python and pip directly from python.org
If you prefer not to use Homebrew, you can download Python directly. Go to python.org, click the Downloads button, and download the macOS installer for the latest Python version. The site detects your Mac automatically and offers the right version.
Run the installer and follow the prompts. It will install Python and pip together. When it finishes, open a new Terminal window and type:
pip3 --version
If you see a version number, you are done. If you see "command not found", the installer may not have added Python to your system path. Restart your Mac and try again — this usually fixes it.
Checking that pip is working
After installation, the best way to confirm pip is working is to actually use it. In Terminal, type:
pip3 install requests
This downloads and installs the Requests library, a common Python package. You should see output showing the download progress and ending with "Successfully installed requests". If you see that message, pip is working correctly.
To remove the test package afterward, type:
pip3 uninstall requests
Type y when prompted to confirm. This does not break anything — you can always reinstall it later if you need it.
Why you should use pip3, not pip
You may see instructions online that say to use pip instead of pip3. On modern Mac systems, pip3 is the correct command because it explicitly tells your system to use Python 3. The older pip command sometimes points to Python 2, which is outdated and no longer supported.
If you type pip --version and it shows Python 2, use pip3 for all your package installations. If it shows Python 3, either command works, but pip3 is clearer about what you are doing.
Troubleshooting: pip still not found after installation
If you installed Python but Terminal still says "command not found" when you type pip3 --version, the most common cause is that your shell does not know where Python is located. Restart your Mac first — this often fixes the problem because Terminal needs to reload your system settings.
If restarting does not work, check which shell you are using by typing echo $SHELL. If it says /bin/zsh, you are using the default shell on modern Macs. Open a completely new Terminal window (not a new tab) and try pip3 --version again.
If you installed Python from python.org and it still does not work, you can run the Python installer again and make sure the "Add Python to PATH" option is checked (it usually is by default). After reinstalling, restart your Mac.
Using pip to install packages for your projects
Once pip is working, you use it from Terminal to download libraries your code needs. The basic command is:
pip3 install package-name
Replace "package-name" with the actual name of the library. For example:
- pip3 install flask installs Flask, a framework for building web applications
- pip3 install pandas installs Pandas, a library for working with data
- pip3 install beautifulsoup4 installs BeautifulSoup, a tool for parsing web pages
When you run one of these commands, pip downloads the package and any other packages it depends on, then installs them all. After that, you can use the library in your Python code by typing import package-name at the top of your script.
Frequently Asked Questions
Do I need to use sudo when running pip commands?
No. If you installed Python using Homebrew or from python.org, pip has permission to install packages without sudo. Using sudo with pip can cause permission problems later. If pip tells you that you do not have permission, the problem is usually that you installed Python in a way that requires administrator access — reinstalling using Homebrew or python.org directly fixes this.
What is the difference between pip and pip3?
Pip3 explicitly uses Python 3, while pip may use Python 2 or Python 3 depending on your system. Since Python 2 is no longer supported, always use pip3. On some systems they point to the same thing, but pip3 is always the safer choice.
Can I have multiple versions of Python on my Mac at the same time?
Yes, and it is common. You might have Python 3.10 and Python 3.12 both installed. Each has its own pip version. To use pip for a specific Python version, type the full version number: pip3.12 install package-name uses the pip for Python 3.12. Check which versions you have by typing python3 --version.
What if I want to uninstall pip?
Pip is part of Python, so uninstalling pip means uninstalling Python. If you installed Python using Homebrew, type brew uninstall python3. If you installed from python.org, go to Applications > Python 3.x and run the "Install Certificates.command" file, then use the uninstaller in that folder. You do not need to uninstall pip separately.