Installing Python on macOS

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

Confirming Your Python Installation

To quickly confirm your Python installation is working correctly, try the following command in Terminal: 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”: Now, at the command prompt, run the following: If you get the above output, your up-to-date Python installation is ready to go.

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 older than the current one. Your other alternative is to install an up-to-date version 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.