macOS ships with Python 2 by default, you can install set Python 3 as the default Python version on your Mac.
First, you install Python 3 with Homebrew.
brew update && brew install python
To make this new version your default, you can add the following line to your
~/.zshrc file (or
~/.bashrc if you want to expose it in
bash instead of
Then open a new Terminal and Python 3 should be running.
Let's verify this is true.
python --version # e.g. Python 3.8.5
Homebrew provides info about any installed "bottle" via the
brew info python # firstname.lastname@example.org: stable 3.8.5 (bottled) # Interpreted, interactive, object-oriented programming language # https://www.python.org/ # /usr/local/Cellaremail@example.com/3.8.5 (4,372 files, 67.7MB) * # ...
And you can find the path we're looking for
brew info python | grep bin # /usr/local/bin/python3 # /firstname.lastname@example.org/libexec/bin
You can also symlink
ln -sf /usr/local/bin/python3 /usr/local/bin/python
In case your
/usr/local/bin/python3 is also symlinked, you can check where it's symlinked to with:
In my case, it returns
Your system's Python 2.7 is still there.
/usr/bin/python --version # e.g Python 2.7.16
You can also use Homebrew's Python 2.
brew install python@2