Skip to main content

Installing Python on macOS

Do not modify or remove Python-related tools supplied by macOS. Install a separate current Python 3 runtime for your own projects. The CPython project provides a signed, notarized universal installer for supported macOS versions at python.org.

Install from python.org​

  1. Download the current macOS installer from python.org.
  2. Open the .pkg and complete the installer.
  3. Run the installer's certificate setup command if the installer documentation requests it.
  4. Open a new Terminal window and verify the interpreter and pip:
python3 --version
python3 -m pip --version

The exact patch version changes over time. Confirm that the reported major/minor line is supported by the packages your project needs.

Homebrew alternative​

If your workflow already uses Homebrew, its Python formula is a valid separately managed distribution:

brew install python
python3 --version

Follow Homebrew's upgrade and removal rules for a Homebrew-managed interpreter. Do not mix files from the python.org installer into a Homebrew installation.

Create a project environment​

mkdir example-project
cd example-project
python3 -m venv .venv
source .venv/bin/activate
python -m pip --version

After activation, python and python -m pip refer to the environment. Add .venv/ to version control ignore rules. Leave the environment with deactivate.

Troubleshooting​

Use command -v python3 and python3 -c "import sys; print(sys.executable)" to see which interpreter the shell selected. If it is not the distribution you intended, review shell PATH configuration rather than using sudo pip or modifying the system installation.