On Linux or MacOS:

python -m ensurepip --upgrade

If you want to install pip for Python 3, replace python with python3.

See https://pip.pypa.io/en/stable/installation/ for more details.

Answer from Scott Tesler on Stack Overflow
🌐
Homebrew
docs.brew.sh › Homebrew-and-Python
Python — Homebrew Documentation
The Python formulae install pip (as pip3). Python@3.11 and older Python formulae also install Setuptools. Starting with Python 3.12, the bundled Python packages should be updated by reinstalling brewed Python.
Top answer
1 of 16
3498

On Linux or MacOS:

python -m ensurepip --upgrade

If you want to install pip for Python 3, replace python with python3.

See https://pip.pypa.io/en/stable/installation/ for more details.

2 of 16
795

TL;DR — One-line solution.

Run the following command for Python v2.7 (default on Mac as of 2021)

curl https://bootstrap.pypa.io/pip/2.7/get-pip.py | python

Run the following command for Python v3

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

Or the following if you have it installed as Python 3

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

Another GIF image you said? Here you go!


The following used to work in 2019 and before

All you had to do was:

sudo easy_install pip

2019: easy_install has been deprecated. Check Method #2 below for the preferred installation!

Details:

OK, I read the solutions given above, but here's an easy solution to install pip.

The macOS comes with the Python environment installed. But to make sure that you have Python installed open the terminal and run the following command.

python --version

If this command returns a version number that means Python exists. This also means that you already have access to easy_install considering you are using macOS or OS X.

Now, all you have to do is run the following command.

sudo easy_install pip

After that, pip will be installed and you'll be able to use it for installing other packages.

P.S. I ended up blogging a post about it. QuickTip: How Do I Install pip on macOS or OS X?


Method #2: Two line solution

easy_install has been deprecated. Please use get-pip.py instead.

Download and install PIP

curl https://bootstrap.pypa.io/get-pip.py | python
🌐
Reddit
reddit.com › r/learnpython › brew vs pip3: what should i use to install python packages?
r/learnpython on Reddit: Brew vs pip3: What should I use to install python packages?
August 13, 2024 -

I recently used brew to install tkinter package. It changed sys path variable and ventured into opt directory as well. Is that ok? Post this pydoc3 is showing duplicate packages. Would pip3 avoid this and make it clean. Which is recommended?

🌐
Setapp
setapp.com › how-to › install-pip-on-mac
How to install pip on Mac
February 1, 2024 - Another way to install pip that’s only available to Python 3 users is get-pip. ... Out of the three methods we describe today, this one is the riskiest and the least recommended, since you’re using an online script. ✕ ... Regardless of the installation method you choose, you should quickly verify that the installation has gone correctly. ... If you see an error and you did brew install pip, a common fix is to use brew unlink python && brew link python.
Find elsewhere
🌐
Homebrew
formulae.brew.sh › formula › pip-tools
pip-tools — Homebrew Formulae
brew install pip-tools · Locking and sync for Pip requirements files · https://pip-tools.readthedocs.io · License: BSD-3-Clause · Development: Pull requests · Formula JSON API: /api/formula/pip-tools.json · Formula code: pip-tools.rb on ...
🌐
GeeksforGeeks
geeksforgeeks.org › python › how-to-install-pip-in-macos
How To Install PIP in macOS - GeeksforGeeks
July 12, 2025 - Learn how to install and use PIP on macOS with this step-by-step guide. Troubleshoot common errors, upgrade PIP and install Python packages easily on macOS.
🌐
Playwright
playwright.dev › installation
Installation | Playwright Python
Install the Pytest plugin: pip install pytest-playwright · Install the Pytest plugin: conda config --add channels conda-forge conda config --add channels microsoft conda install pytest-playwright · Install the required browsers: playwright ...
🌐
Fish Shell
fishshell.com
fish shell
brew install fish · sudo port install fish · 10.9+, Intel or Apple silicon Installs to /usr/local/ 10.9+, Intel or Apple silicon No installation required · fish.app bundles the fish shell with an AppleScript that launches it in Terminal. Nothing is installed.
🌐
Podman
podman.io › installation
Podman Installation | Podman
An Ansible Role is also available to automate the installation of the above statically linked binary on its supported OS: sudo su - mkdir -p ~/.ansible/roles cd ~/.ansible/roles git clone https://github.com/alvistack/ansible-role-podman.git podman cd ~/.ansible/roles/podman pip3 install --upgrade --ignore-installed --requirement requirements.txt molecule converge molecule verify
🌐
GitHub
gist.github.com › Daeinar › 4383663
Install pip packages with homebrew · GitHub
pip3 install BetterADBSync error: externally-managed-environment × This environment is externally managed ╰─> To install Python packages system-wide, try brew install xyz, where xyz is the package you are trying to install.
🌐
freeCodeCamp
freecodecamp.org › news › python-version-on-mac-update
How to Install Python 3 on Mac – Brew Install Update Tutorial
April 6, 2021 - Just re-run the above pyenv install 3.9.2 and it should now work. First you need to update your Unix path to pave a way for PyEnv to be able to interact with your system. This is a long explanation of how PATH works in MacOS (and Unix), straight from the pyenv GitHub repo. When you run a command like python or pip, your operating system searches through a list of directories to find an executable file with that name.
🌐
FastAPI
fastapi.tiangolo.com › tutorial
Tutorial - User Guide - FastAPI
If you don't want to have those optional dependencies, you can instead install pip install fastapi.
🌐
Grafana
grafana.com › docs › k6 › latest › set-up › install-k6
Install k6 | Grafana k6 documentation
sudo dnf install https://dl.k6.io/rpm/repo.rpm sudo dnf install k6 · Using Homebrew: Bash Copy · brew install k6 · If you use the Chocolatey package manager you can install the unofficial k6 package with: Copy · choco install k6 · If you ...
Top answer
1 of 2
3

Maybe it is time to consider using virtualenv. Virtualenv creates self-contained python environments using the python version you specify. After activating the new virtual environment, everything you install using pip goes under that environment. This helps avoid situations like the one you described.

E.g. create and activate a new python environment using the default python:

# create environment
$ virtualenv --distribute myproject
New python executable in myproject/bin/python
Installing distribute...done.
Installing pip...done.

# activate environment
$ . ./myproject/bin/activate

# check default python
(myproject)$ which python
/Users/me/myproject/bin/python

It is suggested to use the --distribute options to indicate that distribute should be used for installing packages in the new environment instead of (the older) setuptools. After activation your command prompt changes to indicate which python environment is active.

Now install some package. The files will go into myproject directory:

# install django
(myproject)$ pip install django
...

# search for django dir
(myproject)$ find myproject -iname django
myproject/lib/python2.7/site-packages/django

Finally, deactivate:

# deactivate and check for default python
(myproject)$ deactivate
$ which python
/usr/bin/python

To create an environment using a non-default version of python:

$ virtualenv --distribute -p /path/to/custom/python mynewproject

By default virtualenv will copy to the new environment any packages installed for the python version you use to bootstrap it. To prevent this and create an empty environment use the --no-site-packages option. This is especially useful to create environments which can be exactly replicated e.g. from development to production.

Update: As of version 1.7 --no-site-packages has become the default behaviour of virtualenv.

If you want more details, there are plenty of tutorials and blog posts online. E.g.:

  1. Notes on using pip and virtualenv with Django. (most of the post is not django-specific)
  2. Working with virtualenv.

Give it a try and I'm sure you'll stick with it.

Note: Make sure that your executable scripts do not have the python interpreter hardcoded. I.e. their first line should be #!/usr/bin/env python and not something like #!/usr/bin/python.

2 of 2
0

My suggestions:

  1. Install the xcode commandline tools package via Xcode -> Preferences -> Downloads-> Components:

  2. Install homebrew (upgrade your path in .profile, .SHELLrc or whatever to include /usr/local/bin before the system default like /usr/bin).

  3. For python first install all the prereqs by themselves:

    • brew install readline sqlite gdbm pkg-config
    • brew install python --framework --universal
    • update your path so that it uses the right distutils: export PATH=/usr/local/share/python:$PATH
  4. easy_install pip

  5. pip install virtualenv
  6. pip install virtualenvwrapper
  7. Include export PYTHONPATH=/usr/local/lib/python:$PYTHONPATH
🌐
Medium
evinsellin.medium.com › an-opinionated-python-setup-for-mac-2021215dba8f
An Opinionated Python Setup Guide for Mac | by Evin Sellin | Medium
February 28, 2023 - Upgrade python with brew update && pyenv install [version] && python global [version] Never manually modify $PATH for Python purposes. Use pypi for as your package repository almost exclusively. Never use $PYTHONPATH. Instead, opt for builtin dependency resolution methods in Pipenv or Poetry.
🌐
The Hitchhiker's Guide to Python
docs.python-guide.org › starting › install3 › osx
Installing Python 3 on Mac OS X — The Hitchhiker's Guide to Python
$ brew install python · This will take a minute or two. Homebrew installs pip pointing to the Homebrew’d Python 3 for you. At this point, you have the system Python 2.7 available, potentially the Homebrew version of Python 2 installed, and ...