Make Python 3 Default in MacOS


Python users on Mac probably know that Python is deprecated from macOS 12.3 and will no longer come pre-installed on Mac. But Python remains an incredibly popular programming language, and if you rely on Python, you’ll probably want to continue to have Python available in macOS. It’s easy to get Python 3 on Mac, so let’s dive deeper and show how you can make Python 3 the new default Python version in macOS, whenever the python command is run.

Install Python 3 on Mac

If you have already installed Python 3 on Mac using the official Python installer from here or Homebrew, you can skip this section.

If you haven’t installed Python 3 yet, it’s easy to do so with a single homebrew command:

brew install python

This will install the latest version of Python 3 available through HomeBrew. Again, you can also install it using the Python 3 installer, or even the MacAdmins Python version if you prefer.

How to Make Python 3 the Default in MacOS

We’re assuming you’re using the default Zsh shell (or Oh My Zsh) and modifying .zshrc like that, but if you’re still using bash, you’ll add the alias in .bashrc instead.

  1. From the Terminal, open zshrc in your text editor of choice, we’ll use nano for convenience:
  2. nano ~/.zshrc

  3. Add the following alias to the bottom of the .zshrc file:
  4. alias python=/usr/local/bin/python3

  5. Press Control-O then Control-X to save the change, then exit nano

You can now confirm that the alias worked by checking the python version:

$ python --version
Python 3.9.8

This should be the same response as typing, since the python command has been aliased to python3:

python3 --version

Remember this is just an alias. If you continue to have the original version of Python 2.7.x installed on the Mac, it remains accessible and usable by specifying the full path, like this:


Keep in mind that in future versions of macOS, Python 2.x will no longer be provided.

We’re using aliases here in this example, but you can use a symbolic link from /usr/bin/python3 to /usr/bin/python instead if you prefer to go that route.

What happened to Python in macOS?

For those unaware, Apple has been warning for some time that Python will be deprecated from future versions of macOS, and that moment has finally arrived with macOS Monterey 12.3. This is found in the developer’s noteslisted under Dropouts:

Python 2.7 has been removed from macOS in this update. Instead, developers should use Python 3 or another language. (39795874)

So if you are or were dependent on Python 2.7.x for some particular reason, you will either need to update your programs for Python 3 compatibility or maintain an older, outdated version of Python 2.x (which is possible with Homebrew, etc.), or rewrite everything and switch to another language entirely.

If you have any insights, insights, or relevant experiences with Python in the latest versions of macOS, share them in the comments.


About Author

Comments are closed.