How to install Python on mac

Python programming language is one of the most popular and powerful programming languages, and its uses are widespread in the areas of Data Science, Machine Learning, Application Development, Web Development, etc. So, if you are willing to learn Python programming language, you might want to get the latest version of python installed in your systems.

So, if you are having a Mac, and are wondering “How can I install python on my Mac?”, well, we have got you covered, since we are going to go through some different steps, through which, we can understand how to install the latest version (or some other version) of python in the mac.

Also, after we are done installing Python on our Mac, we would try to test it, by running a few commands on the terminal. So, let’s quickly dive into the installation process.

Installing Python on Mac

The thing is that by default, Python 2 is installed on your Mac, but the thing is that Python 2.7 is no longer supported. So, you might want to get the latest version of python 3, in order to get started with the learning process or to develop something using python. So, let’s have a look at some simple steps, through which, we can install Python on our Mac. Just before that, here are the things that we need in order to download and install python on Mac.

  • Mac
  • Browser
  • Internet connection

So, having checked all the things let’s now move on to have a look at some simple steps, through which, we can understand the installation process of the latest version of Python 3 on Mac, and we will also check the currently installed version on our mac first.

To check the currently installed version of Python, just follow the given instructions –

  • Open the terminal on your Mac.
  • Type or copy-paste the command python –version, to get the information about the current version of python installed.

Also, similar to this, we can also check the version of python 3 installed on our Mac. Most probably, if you do not have Python 3 installed on your Mac, you would see some different messages. You can check the same for Python 3. To check, you just need to write python3 instead of python in the previous command.

What are some different ways to install Python on Mac?

As mentioned earlier, On your Mac, Python 2 is pre-installed, but the thing is that it is no longer supported. So, we have to get the Python 3 version ourselves, and there are some different ways to achieve our goal. Here are some ways we can install Python 3 on our Mac.

  • Downloading some version of Python 3 from the official Python website
    Through this, we are going to download some version of Python 3 from the official Python website and install it in our system.
  • Using the Homebrew Package Manager
    Here, we first need to Homebrew Package Manager, if not already installed, and then we can install Python 3 using the Homebrew Package Manager. Homebrew can be considered as a Package Manager for easy software installation on macOS.

Downloading Python 3 from the official Python website

So now, let’s move on to installing Python on the Mac. For this, we just need to follow the given set of instructions, and the downloading and installation will be done. Note that we are going to go to the official Python website for downloading Python. So, here are the steps –

  • Open your Browser on Mac
  • Just search for python.org on the search engine, and go to the website.
  • When you are on the homepage, you can find the option for Downloads. Either you can hover over it to find the latest version available for download, or you can also click on it.
  • You can find a button to download the latest version of Python. When you click on it, the download should start. Note that we are downloading the latest version, but if you want an older version, you can find the download links for that as well.
  • Once the file is downloaded, just run the installer.
  • When the installer runs, you can go through the introduction, and just press on to continue to move to the next steps.
  • You can go through the Read me, and press on continue, to move to the next step.
  • After that, you can see the license, you can go through it, and just press on to continue to move to the next step.
  • Now, you have to click on Agree to continue the installation(if you agree with the terms and conditions).
  • Now, you need to select the destination for installation(it is recommended to keep the default location).
  • Once you have gone through all the steps, the installation starts, and you get the message once the installation is done. It says that Python has been successfully installed.

So, just going through these simple steps, you can easily download and install the required version of python 3 from the official Python website.

Installing Python 3 using Homebrew Package Manager

If you want to install Python 3 from the command line, then using the Homebrew Package Manager can be a good choice. If you do not have the Homebrew Package Manager installed on your Mac already, then first, you will have to install it, and then you can continue with the installation of Python 3, using the Homebrew Package Manager. You can find the stepwise guide for both installation processes below.

Step 1 – Installing Homebrew Package Manager (You can skip this step if you already have it installed)

  • Open your browser.
  • On your browser, just type in or search for https://brew.sh/
  • There, you can find the command to install Homebrew, under the title Install Homebrew. You just need to copy that command.
  • Now, you need to open the terminal.
  • On the terminal, you can paste the command that you had copied earlier, and hit the enter key.
  • The Homebrew installation should begin. You might be asked for your Mac credentials to proceed. You might also get pop – an up asking for the installation of Apple’s command line developer tools.

So, following the above simple steps, Homebrew Package Manager should be installed on your Mac.

Note: If you already had installed the Homebrew Package Manager, and now, you want to update it, you can run the below-given instruction.

brew update && brew upgrade

Step 2 – Installing Python 3 using Homebrew

  • Open your terminal.
  • On the terminal, just type in the command brew install python3

Just using this simple instruction, Python 3 should be installed on your Mac. Now, when we are done with the installation, we should verify if the installation is correctly done or not. For that, we just need to follow the given instructions.

  • Open the terminal.
  • You can type pip3 on the terminal, and just hit enter.
    Or you can also try the below steps to verify the installation.
  • Just type python3 in the terminal, and just hit enter.
  • You should get some information about the installed version of Python 3.

Also, when we have installed Python 3, it brings up something called IDLE, or Integrated Development and Learning Environment. It can be considered a simple, and easy-to-use environment for writing and running our Python scripts. So, if you search for IDLE on your Mac, you can find it and launch it. There, you can also create a new python file, and write your python code there.

Other than this, you can also use the IDE or code editor that you are already familiar with. There are a lot of IDEs and code editors that we can use. Many are open-source, and some are paid as well.

Conclusion 

In this article, we have seen how can we install Python(specifically Python 3) on our Mac. Python 2 is pre-installed on Mac, but the thing is that it is no longer supported, so, if we want to learn python or use python for development purposes, we would need to install it ourselves.

In this article, we have seen some different ways to install Python 3 on your Mac. You can download and install some version of Python 3 from the official Python website, or you can also use the Homebrew Package Manager to install Python 3. Note that if you do not have the Homebrew Package Manager installed already, you would first need to install it, before proceeding to install Python 3 using Homebrew.

FAQ About How to install Python on mac

Q: How to install Python 3 on Mac?

Ans: There are different things that we can do to install Python 3 on Mac, you can download and install some version of Python 3 from the official python website, or you can also use the Homebrew Package Manager, to install Python 3.

Q: From where can I download the latest version of Python 3?

Ans: You can find and download the latest version of Python 3 from the official python website.

Q: How to install Python 3 using a terminal on mac?

Ans: If you want to install Python 3 using the terminal, you can make use of the Homebrew Package Manager. If you have not already installed the Homebrew Package Manager, then first you would need to install it, and then you can proceed to install Python 3 using Homebrew on the terminal. The instruction to install Python 3 using Homebrew is very simple.

Q: How to manually install Python 3 on Mac?

Ans: You can visit the official Python website to download the latest(or some other) version of Python 3. and download it, run the installer, follow some simple steps, and the installation is done.