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:
- Download and install MacKeeper.
- When MacKeeper opens, select Smart Uninstaller in the sidebar.
- Click Start Scan to find all the software installed on your computer.
- Select the programs you no longer want, then click Remove Selected to uninstall them.
In this article you will find the following:
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:
- Launch Terminal from the Applications > Utilities folder.
- Type the command python3, 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:
- Install Python on Mac via an installer
- Python installation on macOS with Rye
- 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.1 Download the latest version of Python from the official site
The first thing you’ll need is the official Python installer:
- Download Python 3 from the macOS section on python.org.
- Click Latest Python 3 Release toward the top of the page.
- Scroll down to the Files section and select the macOS 64-bit installer.
- Click Allow when prompted to proceed.
1.2 Run installer
Once the Python installer has finished downloading, it’s time to run it:
- Open your Downloads folder in Finder and double-click the Python package to run it.
- When the Install Python window appears, click Continue, then follow the steps on the 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:
2.1 Install Rye
You can quickly download and install Rye using curl commands in Terminal. Follow these steps:
- Open Terminal using an admin account.
- Enter curl -sSf https://rye.astral.sh/get | bash and then press Enter. Press the y key to continue when prompted.
- 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.
- 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.
- 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.
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:
- When asked if you want to add Rye to PATH via .profile, type n to decline.
- We now need to open the ~/.zprofile file to edit it. In Terminal, type open -e ~/.zprofile and then press Enter.
- 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.
- 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.
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.
2.3 Verify Rye installation
After completing the above steps, verifying your Rye installation is simple:
- In Terminal, type rye --version and 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:
- In Terminal, type python --version and press Enter to display the Python version number.
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:
- Pre-installed Python
- Check that Homebrew is ready
- Brew install
- Verify with brew list
- Brew pin
- Upgrade Python with Homebrew
- Set the $PATH for Homebrew Python
- Verify Python Installation
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:
- Select Smart Uninstaller in the MacKeeper sidebar, then click Start Scan.
- 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.
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:
- Open Terminal, type the brew update command and then press Enter.
- Once any updates are complete, verify Homebrew is ready to install a package by typing brew doctor, then press Enter.
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.
3.3 Brew install
With Homebrew ready and up to date, we can now install Python:
- Type brew install python into Terminal, then press Enter.
3.4 Verify with brew list
Once the installation process is complete, we can verify that Python was installed properly:
- Type brew list python into Terminal, then press Enter to see the list of installed files.
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:
- In Terminal, type brew pin python and then press Enter.
- 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.
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.
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:
- In Terminal, enter open -e ~/.zprofile to open the configuration file in TextEdit.
- 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.
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.
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.