3 Ways to Install Python on MacOS (with VIDEO)

In this tutorial, I will demonstrate how to install python3 on MacOS.

MacOS comes with Python 2 preinstalled, but you will want to install Python 3 to work with the most up-to-date version of Python.

In this post we will cover the 3 main ways to install Python on MacOS


Subscribe to my Newsletter


  1. Install Python With XCode
  2. Install Python With Package Installer
  3. Install Python With Homebrew

Check this If you are looking for alternatives to install Python, or how to install Python on Windows instead.

You can also run Python on Google Colab and that doesn’t require any installation.

Check if Python is Installed on Your Mac

Open Terminal.

$ python --version
$ python3 --version

1. Install Python With Command Line Developer Tool

Installing Python on Mac can be done with the XCode Command Line Developer tool. To do launch Python installation on Mac OS, type in “python --version“. You will get a message saying:

no developer tools were found at '/Applications/Xcode.app', requesting install. Choose option in the dialog to download the command line developer tools.

And a prompt like the one below telling you to install Xcode.

Xcode will also install Python 3 on your MacOS, but also a few other softwares in the process (which you may not want).

If you don’t get the pop-up on your Mac terminal

Install Xcode in the Terminal with the command below:

$ xcode-select --install

2. Install Python with Package Installer

The best place to install Python is from the official website.

Go to Python.org and click on the Download button to download the latest version for MacOS.

Go to your download folder and double-click on the python-<version>-macosx.pkg file to start the Python installer.

Go through each of the prompts.

Keep the default install location.

Close and move installer to Trash.

3. Install Python with Homebrew

To install Python with Homebrew, first install the package installer, add the brew command to the Path and then use the brew install python command in the Terminal.

Brew Install Python

First, install Homebrew.

$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

Then, install brew to Path:

$ export PATH="/usr/local/opt/python/libexec/bin:$PATH"

Next, install Python.

$ brew install python

Check if Python Was Installed Properly on Your Mac

Regardless of the technique that you used to install Python, to check if Python was installed, open the Terminal and type:

$ python3 --version

Alternatively, you can go to the Applications folder and see if Python 3.X is installed.

Check if Pip is Installed on MacOS

$ pip3 --version

If pip is not installed, you can run:

$ python3 get-pip.py

Check Your Mac Python Installation

Check Where Python was Installed on your Mac

Use the which python command to check where Python was installed on your Mac Computer.

$ which python

Check which Version of Python was Installed on your Mac

Use the python --version command in the Terminal to verify the version of Python that you are running in your environment.

$ python --version

How to Uninstall Python on Mac

To uninstall Python on Mac, you need to verify how it was first installed. For instance, Catalina comes with Python installed by default and can’t be uninstalled. That is, here is how you can uninstall Python on MacOS.

Uninstall Python with Homebrew

To uninstall Python with Homebrew, first verify if it was indeed install with brew. To do so, type the which python3 command in the Terminal. If the path to Python looks like this, it means that Python was installed with Homebrew.

/opt/homebrew/bin/python3

Run the brew command to uninstall Python with Homebrew.

$ brew uninstall python3

Uninstall Python Manually from Your Mac

To uninstall Python that was installed manually or with XCode, type the which python3 command in the Terminal to see where Python is installed. Then open Finder and click on the Applications menu. Pick the Python executable file and put it in the trash.

If you have messed up your installation, check out this tutorial that shows you how to clean up Python installations.

Conclusion

We now conclude this tutorial on how to install Python on MacOS. Please make sure to read my series on tutorials on Python SEO to dive deeper.

4/5 - (1 vote)