How To Install Python 3 on Mac OS

Python is a versatile language used for multi-purpose programming it is undoubtedly the most popular dynamic programming language that is being used today.

Python is an open source object-oriented programming language made by Dutchman Guido van rossum in 1991.

Python is an excellent choice for beginners and experienced developers, Python 3 is the most current version of the language and is considered to be the future of Python.

You can verify it by running python --version in your terminal; you should get a similar output like

$ python --version
Python 2.7.15

Python 2 has not been supported since January 1, 2020 and no longer receives any bug fixes, security patches, or other changes. Apple says that developers should use an alternative scripting language going forward, such as Python 3, but it’s worth noting that Python 3 also does not come preinstalled on macOS.

Install Python3

There are various ways to install Python 3, including a download from the official Python site. However, I strongly recommend instead use a package manager like Homebrew to manage all your packages. It will save you from a lot of headaches.

In this blog we will try to install Python 3 on your local macOS machine and setting up a programming environment via the command line.

How to install Python 3 in Mac

Step - 1

Open your terminal, you can find it by going into Finder, navigating to the Applications folder, and then into the Utilities folder. Alternatively, you can use Spotlight by holding down the command and spacebar keys to find Terminal by typing it out in the box.

Step - 2

Xcode is an integrated development environment (IDE) that is comprised of software development tools for macOS. You may have Xcode installed already on your system.
To check, in your Terminal window, execute this command - xcode-select -p

If you receive the following output, then Xcode is installed:


If you get an error then you need to install Xcode first, you can simply install it from the App store Install Xcode

Once Xcode is installed, return to your Terminal window. Next, you’ll need to install Xcode’s separate Command Line Tools app, which you can do by executing the following command.

$ xcode-select --install

Click through all the confirmation commands this may take a while.

Once Xcode and its Command Line Tools app are fully installed, and we are ready to install the package manager Homebrew.

Step -3

In this step, we will install Homebrew which is a package manager. A package manager is a collection of software tools that work to automate installation processes that include initial software installation, upgrading and configuring of software, and removing software as needed.

To install Homebrew run the following command in your terminal -

/usr/bin/ruby -e "$(curl -fsSL"

Homebrew installs packages to their own directory and then symlinks their files into /usr/local.

To confirm the Homebrew installation run this command

$ brew doctor
Your system is ready to brew.

Otherwise, you may get a warning to run another command such as brew update to ensure that your installation of Homebrew is up to date.

Once Homebrew is ready, you can proceed further to install Python 3.

Step - 4

Finally, now you can install the latest version of Python by running

$ brew install python3

The Terminal window will give you feedback regarding the installation process of Python 3. Along with Python 3, Homebrew will install some essential tools such as pip, setuptools, and wheel.

Pip is a valuable tool used to install and manage Python packages. You will use it a lot in your projects.

To verify Python 3 installation, you can run the following

$ python3 --version
Python 3.8.12

Your version might slightly vary, but as long as it’s Python 3 the installation was successful.

To open a Python 3 shell from the command line type python3:

$ python3
Python 3.8.12 (default, Sep 26 2022, 17:47:41) 
[Clang 13.0.0 (clang-1300.0.29.3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

To exit the shell simple type exit() and hit enter.

How to update Python3?

If in future Python team publishes a new update you can update your Python 3 from the terminal by doing the following.

brew update
brew upgrade python3

This will update your Homebrew first followed by Python 3.

Explore More Python Posts

Using Twitter API with Python: Getting Tweets & Insights

Learn how to use the Twitter API with Python to get tweet information and insights. Extract valuable data for businesses and researchers with ease.

Read More
Accessing Facebook Data with Python: Examples for Post Likes, Views, and Profile Details

Learn how to access Facebook data using Python and the Facebook API. Get post likes, views, and comments, and retrieve profile details.

Read More
Python Design Patterns: Examples and Best Practices

Learn about Python design patterns with examples and discover best practices for writing maintainable and scalable code.

Read More
How to Use the YouTube API with Python: A Step-by-Step Guide

Learn how to access and retrieve information from YouTube using Python and the YouTube API. Get code examples and step-by-step instructions for impor…

Read More
Top 3 Python Frameworks for Web Development

Discover the most popular and efficient Python frameworks for building dynamic web applications. Get started today!

Read More
Debugging Made Easy with IPDB - The Python Debugger

Revolutionize the way you debug your Python code with IPdb, the advanced interactive debugger that streamlines your debugging process. Say goodbye to…

Read More