How to Install Python on Mac

For when you need the latest version of Python on your Mac

Python is a popular programming language for creating applications on desktop platforms as well as the web. It's also known as a great place for new coders to start, based on its easy syntax and flexibility. We'll show you how to install the most recent version of Python on your Mac.

Instructions in this article apply to the latest versions of Python and macOS.

Which Python Version to Install on macOS

Python comes pre-installed on macOS, but the built-in version is specific to the version of macOS you're currently running. This means it's only updated when you receive an OS update from Apple. So, if you choose to use the version built into macOS, you may be running a version that's slightly older than the current one.

Your other alternative is to install a more up-to-date versions directly from the Python project. Doing this comes with its own caveats, namely that you'll need to keep up with new releases on your own.

Before deciding this, consider the following:

  • Will your Python programs be solely for your own use, on your own Mac? If so, the built-in version is probably sufficient.
  • Are you going to release your programs for use on a specific platform? When this is the case, it depends on how that platform tracks Python releases (or not). If you're targeting only macOS with your code, then the built-in version is actually a good choice, as you'll always know that the version you're using is the one that your users will have as well. However, if you're writing a web application, you'll need to consider what version of Python your web hosting company supports.
  • Some operating systems, such as Linux, will follow the most recent release of Python closely. In this instance you can also use more recent versions, in order to take advantage of newer features.

Should you decide that you need the latest and greatest after thinking through the above points, the following section will show you how to get it installed in macOS.

Installing Python on macOS

The Python project makes regular releases of Python in standard .PKG format. The following steps will install the standard Python distribution on your Mac:

  1. First, grab the latest release from the Python website. Unless you're on an older machine and have to use a previous version of macOS for some reason, you can download the 64-bit installer file.

  2. This is the standard macOS .PKG format, so you can just click the installer file to proceed.

  3. The first screen will provide some info on the install, you can click Continue to move along.

    The Python Installer's Intro Screen
  4. Click Continue on the following page as well, which is a notice that the project will stop providing support for 32-bit installers from v3.8 onward.

    The Python Installer's ReadMe Information
  5. The next screen asks you to accept the open-source license for Python. You can safely click Continue here, then click Agree.

    Agreeing to the Python Project's Open Source License
  6. You'll need to select a destination for the install on the following screen. You can click Install to place it on your main drive, or click Customize to place it elsewhere.

  7. Now the installer will start copying the files, and the progress bar will tell you when it's complete.

    Python Installer Moving the Program Files
  8. Once the installation is finished, the app's folder will open in Finder.

Confirming Your Python Installation

To quickly confirm your Python installation is working correctly, try the following command in Terminal:

python --version
Python 3.7.4

If you want to further confirm things, try running a simple Python script. Enter (or paste) the following code into an empty text file and naming it "hello-world.py":

print ("Hello World!")

Now, at the command prompt, run the following:

python /path/to/hello-world.py
Hello World!

If you get the above output, your up-to-date Python installation is ready to go.