Installing Python on macOS

In this guide, we will be showing you how to install Python to macOS using the homebrew software.

Installing Python on macOS
Installing Python on macOS requires us to go through a few different steps.

To install Python easily we will require a piece of software called homebrew as well as the compiler GCC, which we will get by installing Xcode.

If you already have Xcode and homebrew installed to your Mac, then you can skip to the “Installing Python using Homebrew ” section of this tutorial.

Installing Xcode on your macOS

The first of these steps is to install Xcode on our device so that we can make use of the GCC compiler.

There are a few different methods for getting the GCC compiler on to your macOS installation, but we will be going down the Xcode route as it is the simplest one.

1. Begin by opening up the “App Store” on your Mac device.

Within here, search for “xcode” (1.) within the search box, then click “Get” (2.) to install it to your operating system.

Installing Xcode

You will be asked to enter your Apple ID’s password for the installation to proceed.

Once the installation process has completed, you can now move on to setting up homebrew on macOS.

Installing Homebrew on macOS

Our next step is to install homebrew. For those who do not know what homebrew is, it is a package manager for macOS.

This package manager allows us to install things like Python and wget in an easy way on macOS.

1. To install homebrew, we will need to first to load up the terminal.

You can either open this by pressing COMMAND + T or by following the next couple of steps to open up the terminal application.

To do this, you must first open up the “Finder” application and open up the “Applications” (1.) folder.

Within here you will find a folder called “Utilities” (2.), open it to proceed.

macOS Applications Folder

2. Within this folder, open the terminal by double-clicking “Terminal“.

Mac Utilities Folder with Terminal

3. Now with the terminal open, you need to enter the following command.

This command will run a ruby script that will install homebrew and all its dependencies to your macOS system.

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Please note that this process can take some time.

4. Once homebrew has finished installing, you can now finally proceed to install Python.

Installing Python using Homebrew

Now we are onto the seccond last section of our guide. This section will show you how to make use of homebrew to install Python to your Mac device.

Don’t worry, this is incredibly simple, thanks to the homebrew software we installed in the previous steps.

1. To get started, you need to first to open up the terminal application.

2. Within this terminal application, we need to enter the following command.

This simple command will download and install both Python and Python’s package manager “pip” to the operating system.

brew install python3

Homebrew will automatically download and set up the latest version of Python on your macOS device. It will also install any dependencies that Python may require.

In our next section, we will quickly run through the steps to verifying that Python is now installed.

Verifying Python is Installed on Mac

1. To verify that Python is installed on your macOS device, you will need to start by opening up a terminal session.

2. Within this terminal session, go ahead and run the following command.

This command will get Python 3 to return its version number.

python3 -V

3. If Python has been successfully installed, then you should see a version string like what we have below appear in your terminal.

Python 3.7.4

Hopefully, by now, you will have Python up and running on your Mac device.

You can now continue with our getting started with Python guide to learn how to setup an IDE to write Python in.‎

If you have run into any issues or have any feedback on installing Python on macOS feel free to drop a comment below.

Leave a Reply

Your email address will not be published. Required fields are marked *