Install Python on Mac

Python is one of the world's most popular coding languages, thanks largely to its incredible versatility. Whether you’re planning to build websites or applications in Python yourself or want to run software that requires it, chances are you’ll want to install Python on Mac at some point.

 

In this guide, we’ll discuss three of the most popular ways to obtain Python for Mac and briefly examine some of the alternatives.

Before we start:

 

You may need to free up some storage on your Mac before you start installing Python. One of the easiest and most effective ways to create space is with MacKeeper Smart Uninstaller. It identifies all the apps installed on your Mac and lets you remove those you don’t need in just a couple of clicks.

 

Try this:

  1. Download and install MacKeeper.
  2. When MacKeeper opens, select Smart Uninstaller in the sidebar.
  3. Click Start Scan to find all the software installed on your computer.
  4. Select the programs you no longer want, then click Remove Selected to uninstall them.

Does Mac come with Python?

Unfortunately, Mac computers no longer come with Python pre-installed since macOS Catalina, although it was baked into older versions of the OS, including Mojave and earlier. If you want to take advantage of Python on your Mac today, you’ll need to set it up and manage it yourself.

 

Even if you’re running a release of OSX that came with Python, it’s likely to be an old version now—especially if you haven’t gone out of your way to update it manually at some point. With that being the case, it’s a good idea to make sure you’re running the latest version before you start using it.

How to check if Python is installed on Mac

There’s an easy way to check if Python is installed on your Mac:

  1. Launch Terminal from the Applications > Utilities folder.
  2. Type the command python3, then press Enter.
The Utilities folder in Finder on Mac. You can launch Terminal and run the python3 command to check if you need to install Python on Mac.
Step 1. Open Terminal from Applications > Utilities.
The python3 command in Terminal on Mac. You can use this command to check if you already have Python installed, and then install Python on Mac if it's absent.
Step 2. Type python3 and then press enter.

If Python is installed on your Mac, you’ll see a version number. If not, you’ll receive an error.

A hint from our team: 

 

Some Python setups require you to use the python --version command in Terminal instead. However, this doesn’t work with Python 3—it will return a “Zsh: permission denied” or “Zsh: command not found” error, even if Python 3 is present. Bear this in mind if you’re used to using the earlier command.

Ways to install Python on Mac

There are a number of different ways you can get Python on Mac, some of which are a little simpler than others, and all work on both Apple silicon (M1, M2, M3, and M4 chips) and Intel machines.

 

Here are three common methods which don’t require too much effort:

  1. Install Python on Mac via an installer
  2. Python installation on macOS with Rye
  3. Install Python on MacBook using Homebrew

Choosing the right install method depends on your requirements. If you need Python just to run programs and utilities that rely on it, then the easy method of using the official Python installer should suit you well. However, if you’re using Python for development in more than one environment, the Rye option is ideal.

 

Before you continue, you may want to uninstall Python from Mac if you already have an older version in place. Having different releases installed can create conflicts if you’re not setting up a virtual environment for each version you require, and this is only really necessary for more complex Python projects.

1. Install Python on Mac via an installer

Installing Python on Mac using the official installer is one of the fastest ways to get it up and running, and it’s likely all you need if you just want to run Python programs and tools. Simply follow these steps:

  1. Download the latest version of Python from the official site
  2. Run installer
  3. Verify installation

1.1 Download the latest version of Python from the official site

The first thing you’ll need is the official Python installer:

  1. Download Python 3 from the macOS section on python.org.
  2. Click Latest Python 3 Release toward the top of the page.
  3. Scroll down to the Files section and select the macOS 64-bit installer.
  4. Click Allow when prompted to proceed.
The official Python website in Safari on Mac. You can download the macOS installer from here to install Python on your Mac.
Step 1. Choose the latest version of Python.
The official Python website in Safari on Mac. Be sure to select the 64-bit installer for macOS to install Python on Mac.
Step 2. Select the 64-bit installer for macOS.
The official Python website in Safari on Mac. After choosing your installer, you may be prompted to confirm the download. Select Allow to continue to install Python on Mac.
Step 3. Click Allow when prompted to continue.

1.2 Run installer

Once the Python installer has finished downloading, it’s time to run it:

  1. Open your Downloads folder in Finder and double-click the Python package to run it.
  2. When the Install Python window appears, click Continue, then follow the steps on the screen.
The official Python installer package inside the Downloads folder on Mac. You can use this package to install Python on Mac.
Step 1. Launch the Python installer from the Downloads folder.
The Python installer for Mac. You'll need to complete each step of the process to install Python on Mac.
Step 2. Click Continue, then follow the steps on screen.

1.3 Verify installation

When the Python installer is complete, a new Python folder containing the official IDE (integrated development environment), named IDLE, the Python Launcher, and some text documents should appear. This means Python installed successfully, but you can verify the installation using the steps above.

2. Python installation on macOS with Rye

If you’re using Python for programming, you may need a more advanced setup, especially if you plan to code more complex projects. A great option for this is to install Python with Rye, which allows you to have multiple “toolchains,” which are essentially different versions of Python, installed simultaneously.

 

Here’s how to install Python for Mac with Rye:

  1. Install Rye
  2. Set the PATH for Rye
  3. Verify Rye installation
  4. Verify Python installation

2.1 Install Rye

You can quickly download and install Rye using curl commands in Terminal. Follow these steps:

  1. Open Terminal using an admin account.
  2. Enter curl -sSf https://rye.astral.sh/get | bash and then press Enter. Press the y key to continue when prompted.
  3. You will be asked which package installer you want to use: uv or pip-tools. Although UV is newer and faster, pip offers greater compatibility. It’s also friendlier to newcomers since a lot of tutorials refer to pip. Select pip-tools with the arrow keys on your keyboard, then press Enter.
  4. Next, you’ll be asked what kind of Python setup you would like. Select Run a Python installed and managed by Rye, then press Enter.
  5. You’ll then need to choose a version of Python to be used as the default toolchain. As standard, the latest version of Python is suggested, so unless you want another version, just press Enter.
Terminal on Mac showing a command that downloads and installs Rye. You can use Rye to install Python on Mac.
Step 1. Enter this command in Terminal to install Rye.
The Rye installation process inside Terminal on Mac. When you install Python on Mac, select the pip-tools option for greater compatibility.
Step 2. Select pip-tools and then press enter.
The Rye installation process inside Terminal on Mac. For most users, selecting the option to install Python on Mac managed by Rye is the best choice.
Step 3. Choose Run a Python installed and managed by Rye.
The Rye installation process in Terminal on Mac. When you use Rye to install Python on Mac, you will be asked which version you want. Simply press enter to select the latest release.
Step 4. When prompted, press enter to select the latest version of Python.

2.2 Set the PATH for Rye

Once Rye has finished installing Python, it will ask if you want to add Rye to PATH via .profile. This is usually best on Linux, but on macOS, it’s preferred to set the PATH in .zprofile. So, let’s set the PATH manually, like so:

  1. When asked if you want to add Rye to PATH via .profile, type n to decline.
  2. We now need to open the ~/.zprofile file to edit it. In Terminal, type open -e ~/.zprofile and then press Enter.
  3. By default, the file will open in TextEdit, the built-in text editor on Mac. However, if you’ve changed your text editor to the Notepad++ alternative for Mac or something similar, the .zprofile file will open inside that instead.
  4. On the last line of your .zprofile configuration file, enter source "$HOME/.rye/env" then save and close the file. You will need to close and reopen Terminal to start a new session for the change to take effect.
Terminal on Mac showing the Rye installation process. You will be prompted to add Rye to PATH when you install Python on Mac using Rye. Select no to choose your own PATH.
Step 1. Type n and press enter to proceed.
Terminal on Mac showing a command to open the .zprofile configuration file. You can edit this to choose your own PATH when you install Python on Mac with Rye.
Step 2. Enter open -e ~/.zprofile, then press enter.
A .zprofile configuration file inside TextEdit on Mac. When you install Python on Mac using Rye, you can add a line to the end of this file to set your own PATH.
Step 3. Add this line to the fine, then save and close it.

Once you’ve set the PATH for Rye, using the Python or Python3 commands will now employ a Rye-installed version of Python, as intended. To confirm the PATH is correct, type the echo $PATH command into Terminal and press Enter. Your directory should have .rye/shims toward the beginning.

The echo $PATH command in Terminal on Mac. You can use this to verify your PATH after using Rye to install Python on Mac.
Enter echo $PATH to verify the PATH configuration.

2.3 Verify Rye installation

After completing the above steps, verifying your Rye installation is simple:

  1. In Terminal, type rye --version and then press Enter.
The rye --version command in Terminal on Mac. You can use this to check your Rye version number before or after you install Python on Mac.
Type rye --version, then press enter.

A version number should be displayed. If you read an error, check that you entered the right command and that you followed the installation steps correctly.

2.4 Verify Python installation

It’s also easy to verify your Python installation like so:

  1. In Terminal, type python --version and press Enter to display the Python version number.
The python --version command in Terminal on Mac. You can use this to check your version number after you install Python on Mac.
Type python --version, then press enter.

If you see the “zsh: command not found error,” check that you set the PATH correctly by repeating the steps outlined above.

3. Install Python on MacBook using Homebrew

If you want to build a simpler project with Python, it’s fairly easy to install Python with Homebrew like so:

3.1 Pre-installed Python

You may have already installed Xcode on your Mac if you’re a software developer, and this includes a version of Python. It’s important that you don’t remove this. Instead, we’ll install the latest version using Homebrew. However, it is safe to uninstall Anaconda from MacBook, along with other third-party tools.

 

One of the quickest ways to uninstall older versions of Python and other unwanted apps on Mac is with MacKeeper’s Smart Uninstaller. It identifies all the software installed on your Mac and lets you remove multiple programs, along with associated files, in just a few clicks.

 

Here’s how to use it:

  1. Select Smart Uninstaller in the MacKeeper sidebar, then click Start Scan.
  2. Once the scan is complete, select all the apps, widgets, plugins, and other items you want to uninstall, then click Remove Selected to delete them.
The Smart Uninstaller in MacKeeper on Mac. You can use this to uninstall unwanted software and older versions of Python before you install Python on Mac.
Step 1. Select Smart Uninstaller, then click Start Scan.
The Smart Uninstaller in MacKeeper on Mac. You can use this to uninstall unwanted software and older versions of Python before you install Python on Mac.
Step 2 Select the program to uninstall, then click Remove Selected.

3.2 Check that Homebrew is ready

Before you can use Homebrew to install Python, you’ll need to ensure it’s ready and up to date:

  1. Open Terminal, type the brew update command and then press Enter.
  2. Once any updates are complete, verify Homebrew is ready to install a package by typing brew doctor, then press Enter.
The brew update command in Terminal on Mac. This checks that Homebrew is up to date before you use it to install Python on Mac.
Step 1. Enter brew update to check brew is up to date.
The brew doctor command in Terminal on Mac, which verifies that Homebrew is ready. Run this before you attempt to install Python on Mac.
Step 2. Enter brew doctor to verify Homebrew is ready.

If Homebrew is not installed, you’ll see the “zsh: command not found” error. To install it, copy and paste /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" into Terminal, then press Enter and follow the steps on the screen.

Terminal on Mac showing a command for installing Homebrew. You'll need this if you want to use brew to install Python on Mac.
Enter this command to install Homebrew.

3.3 Brew install

With Homebrew ready and up to date, we can now install Python:

  1. Type brew install python into Terminal, then press Enter.
The brew install python command in Terminal on Mac. Use this to install Python on Mac using Homebrew.
Enter brew install python, then press enter.

3.4 Verify with brew list

Once the installation process is complete, we can verify that Python was installed properly:

  1. Type brew list python into Terminal, then press Enter to see the list of installed files.
The brew list python command in Terminal on Mac. Use this to verify that the process was a success when you use Homebrew to install Python on Mac.
Type brew list python, then press enter.

3.5 Brew pin

Homebrew will update Python as it sees fit, but you may want to prevent this from happening—especially if some of your projects rely on a specific Python version. You can block automatic updates using a pin:

  1. In Terminal, type brew pin python and then press Enter.
  2. You won’t receive a response to the above command, but you can verify it worked by entering brew info python. You should see pinned at the end of the Python version number.
The brew pin Python command in Terminal on Mac, which prevents Homebrew from installing new versions of Python on Mac automatically.
Step 1. Enter brew pin Python to block upgrades.
The brew info Python command in Terminal on Mac. You can use this to verify that the current Python version is pinned after you install Python on Mac.
Step 2. Enter brew info python to verify the pin.

If you wish to update or reinstall Python using Homebrew later, you can remove the pin by entering the brew unpin python command.

3.6 Upgrade Python with Homebrew

To upgrade Python using Homebrew, simply enter brew upgrade python into Terminal, then press Enter. Note that we used upgrade not update here, since the update command is for Homebrew itself.

The brew upgrade python command in Terminal on Mac. After you install Python on Mac, you can use this command to update it when necessary.
Enter brew upgrade Python to install the latest release.

Remember, some of your projects and programs may require a certain version of Python to function correctly. It’s recommended that you check these dependencies before performing an update to avoid breaking something you need.

3.7 Set the $PATH for Homebrew Python

After installing Python with Homebrew, you’ll need to set the $PATH manually, as is normal with most install methods. Here’s how to do this:

  1. In Terminal, enter open -e ~/.zprofile to open the configuration file in TextEdit.
  2. On the last line of the file, enter export PATH="$(brew --prefix python)/libexec/bin:$PATH" and then save and close it. Your Homebrew version of Python will now take precedence over any other Python installs, but remember to close and relaunch Terminal for the changes to take effect.
Terminal on Mac showing a command to open the .zprofile configuration file. You can edit this to choose your own PATH when you install Python on Mac with Homebrew.
Step 1. Enter open -e ~/.zprofile, then press enter.
A .zprofile configuration file inside TextEdit on Mac. When you install Python on Mac using Homebrew, you can add a line to the end of this file to set your own PATH.
Step 2. Make this the file's final line, then save it.

3.8 Verify Python installation

To verify that Python is installed correctly using Homebrew, enter which python into the Terminal and then press Enter. You should see a Python version number, along with the PATH you set above.

The which python command in Terminal on Mac. You can use this to verify your Python version number after you install Python on Mac using Homebrew.
Use the which python command to verify the PATH.

Other methods to install Python on Mac

Depending on how you want to use Python, other installation methods may be more suitable. Those we’ve detailed above are some of the most common, and they should serve most use cases, but if they don’t fit your needs, you might want to look at installing Python with pyenv or with Conda.

Best way to install Python on Mac

One of the great things about Python is that it’s so flexible. No matter how you want to use it, you’ll find a setup method that perfectly fits your needs. For most Mac users, we recommend two options: the official Python installer for running Python apps and installing with Rye for development.

 

If you need to remove Python programs and other unwanted software, check out MacKeeper’s Smart Uninstaller. It can clear all the applications you don’t need in one go and remove all their associated files, which other uninstall methods typically leave behind.

Use your Mac to the fullest! Sign up and get:
Effective tips on how to fix Mac issues
Reliable advice on how to stay safe online
Mac-world news and updates

Thank you!

You’ll love exploring your Mac with us.

Oops, something went wrong.

Try again or reload a page.

Here’s another sign you need to upgrade your macOS ASAP:

30% off your MacKeeper subscription

Сopy the code now and use it in the MacKeeper checkout after the upgrade.

Copy Code

Please be aware that this code cannot be combined with any other discounts, offers, or promotions.

Contents

Unlocked
PC

MacKeeper - your all-in-one solution for more space and maximum security.

Try Now

Read more

How to Change Folder Color on Mac
How to Change Folder Color on Mac
How to Use Emojis on Mac
How to Use Emojis on Mac
arrow

Run Application

step_1

Click Continue

step_2

Click Install

step_1

Your macOS version is lower than OS 10.11. We’d like to offer you MacKeeper 4 to solve the cleaning, privacy, and security issues of your macOS.