In Development Last updated:
Share on:
Cloudways offers managed cloud hosting for any size business to host a website or complex web applications.

Wondering how to install Python on Mac to utilize the robust hardware and operating system configuration of your Mac to develop and test programs faster? Keep reading!

Python is not just a programming language; it’s a cornerstone of the tech world, powering everything from web applications to machine learning algorithms. If you’re a Mac user, you’re in for a treat because the combination of Python and macOS creates a dynamic duo for software development and data science.

Python’s versatility, readability, and extensive libraries make it the go-to language for professionals and beginners alike. When paired with the user-friendly environment of macOS, you have a powerful combination that simplifies coding, experimentation, and project development.

Whether you’re a seasoned developer or a curious beginner, the Mac-Python alliance can significantly enhance your productivity.

In this comprehensive guide, I’ll walk you through various methods for installing Python on your Mac, ensuring a seamless setup.

How Crucial Is Python as a Programming Language?

Python is an indispensable programming language for the world of computation. Its readability and simplicity make it accessible to beginners, while the robust libraries and frameworks cater to advanced users. Also, its versatility spans web development, data science, machine learning, and robotic process automation. 

Python is integral to data analysis and artificial intelligence. That’s because its open-source nature fosters a vibrant community, and freelance or white-collar developers love to code programs or data science solutions as a Python script. Globally, developers know that they can get ample and reliable support for free for Python should the code break. 

Moreover, tech giants like Google and Facebook heavily rely on it. Python’s ubiquity in education aids new programmers. Its adaptability ensures it remains a fundamental tool for diverse tasks.

Also read: 15 beginner Python Projects to Practice and Learn

Reasons To Install Python on Mac

The primary reason to use macOS and Python for programming is extreme security that no other operating system except Linux can provide. Hackers and spammers around the world develop malware and virus programs for Windows PCs because the majority of computer users use Windows. 

Since macOS has a smaller market share, hackers rarely target MacBooks and iMacs. Also, Apple has a robust security team that leaves no stone unturned to make macOS virtually immune to malware and viruses.

Other major reasons are as follows:

  • MacBooks and iMacs have been specifically known for creative, scientific, and computer programming works.
  • macOS is Unix-based, providing a robust command-line interface for development and scripting.
  • Mac comes with a suite of developer tools like Xcode, Terminal, and Homebrew.
  • Macs are known for their high-quality hardware, ensuring a smooth and reliable development experience.
  • The intuitive macOS interface is conducive to productivity, with an efficient window management system.
  • If you’re into iOS app development, Mac is essential due to its compatibility with Xcode.
  • Macs tend to have a longer lifespan and are known for their reliability, reducing downtime.  

Do Macs Come With Python for Mac Pre-Installed?

macOS uses Python scripting for some of its tasks and modules in the backend. Hence, until macOS 12.3, it would ship all MacBooks and iMacs with pre-installed Python 2.7 framework.

However, developers have stopped using Python 2.X editions because the Python Software Foundation is no longer supporting this Python build.

So, Apple announced in 2019 in a macOS Catalina 10.15 release note that it’ll stop shipping MacBooks and iMacs with preinstalled Python 2.7. However, Apple delayed the process and finally did it for macOS Monetery 12.3 releases. 

So, if you’re using a dated Mac before macOS 12.3, you should have Python 2.7 preinstalled on your system. The newer Macs, like Ventura and Sonoma, no longer come with any build versions of Python. 

If you need Python 3.X edition for functional programming, you must install it yourself by following any of the methods mentioned in the below sections.

How To Install Python on Mac

There are various ways to set up Python on Mac. Find below all the effortless and popular ways:

Update the Existing Version of Python for Mac

If you’re using macOS 12.3 or earlier versions, your MacBook or iMac already has a Python distribution. You just need to update or upgrade it to the latest Python build so you can develop awesome programs. Find below the steps:

Check Python Version

  1. Launch the Terminal app by looking it up on Spotlight.
  2. Type the following code in Terminal and hit Return:
python --version
  1. The Terminal should show a version of the Python distribution like 2.7.

Since I’m using macOS Ventura to write this guide, my system is unable to show any Python distribution version because it doesn’t have any. But, macOS systems older than 12.3 will show a Python version.

Install Homebrew

After knowing your Python version, follow these steps to update or upgrade it using Homebrew:

  1. Copy and paste this command into the Terminal app:
/bin/bash -c "$(curl -fsSL"
  1. Hit Return to execute.
  1. Enter the system password to authenticate the action.
  2. Now, the Terminal will go through various stages to download the distributions it needs.
  1. Wait until you see the “Installation Successful” message.
  1. Now, copy and paste the following script and hit Return to install Brew to Path:
echo 'eval "$(/opt/homebrew/bin/brew shellenv)’ >> 
/Users/tamaldas/.zprofile eval $(/opt/homebrew/bin/brew shellenv)
  1. The above script is generated at the end of the Homebrew installation on the Terminal so you can copy it from there or edit the username in this /Users/tamaldas/.zprofile code element before using the code.

Update or Upgrade Python Distribution

Now that you have Homebrew in your MacBook or iMac follow these steps to update or upgrade Python:

  1. Go to the same Terminal console.
  2. Copy and paste this code into it:
brew upgrade python
  1. This will start updating the existing Python installation after authorizing the action with a password.

The code will work just fine on an older Mac that has the Python 2.7 framework. Since I’m using the latest Mac, Python isn’t available, and hence the Terminal shows this message, “zsh:command not found.”

Once the process is over, reboot the Mac to enjoy the latest Python distribution when coding.

Install Python on Mac Using an Installer

This is the most convenient way of installing the latest Python edition on Mac. Follow the steps mentioned here:

Get Python for Mac

  1. Open Safari browser and visit the official website of Python language.
  2. Click the Downloads menu on the webpage menu.
  3. Click on the Download Python 3.12.0 button.
  1. A security popup might show up. Click Allow.
  2. The package will download and directly show up on the Dock of macOS.
  1. Click on the Python installer to begin.

Install the Python Package

  1. Clicking the Python installer will show the Open in Finder button.
  2. Click on that.
  3. You should now see the installer in the Downloads directory of your Mac.
  1. Double-click the Python PKG file and the Install Python dialog will show up.
  2. Click Continue on this window.
  3. Again, click Continue on the Important Information dialog.
  1. You must click Continue and Agree on the Software License Agreement dialog.
  2. Now, select your Macintosh HD disc as the installation directory for Python, and click Continue.
  1. Finally, click Install to start the package setup process.
  2. Authorize the process with the Touch ID or Mac passcode.

Once the installation is over, you should see the above folder.

Validate the Installation

Once installation is over, here’s how to validate the Python distribution:

  1. Open the Terminal app.
  2. Type the following command into it:
python3 --version
  1. Hit Return.
  2. The Terminal should now show the installed Python version.
  3. If it matches with the version you installed, Python is working fine.

Another way to verify the Python installation is by executing the Python IDLE script. It launches the integrated development environment of Python. Here’s how:

Double-click the IDLE file on the Python 3.12 installation folder. It should show up once the installation is complete. 

You should see the above Python scripting window. There, type the following Python script and hit Return:

print("Hello, World!")

This should create the following response from Python:

It confirms that your Python 3.12.0 installation is successful. 

Install Python on Mac With Command Line Developer Tools

  1. Open Terminal and run the following command:
python3 –version
  1. You should see the following message in a pop-up:
The “python3” command requires the command line developer tools. 
Would you like to install the tools now?
  1. Click the Install button.
  2. On the License Agreement page, click Agree.
  3. You should see the “Downloading software” dialog.
  1. Allow the process to complete itself.

Once the process is over, run the command “python3 –version” again on the Terminal app and it should show the installed Python distribution version.

Install Python on Mac Using Homebrew

  1. Run the Homebrew command as explained previously.
  2. Once Homebrew is installed on your Mac, open Terminal and run this command:
brew install python
  1. The Homebrew package manager will start downloading and installing the latest Python framework compatible with the Mac.
  1. When the process is over, run the “python3 --version” command again to confirm the installed Python version.

Also read: Python Libraries and Modules Every Developer Should Know

How To Uninstall Python on Mac

There are two ways to remove the Python framework from your Mac. You can uninstall using the graphical user interface if you installed it using the package installer or the Terminal app. Here are the methods and their steps: 

Uninstall Python for Mac From Applications

  1. On your Mac, click Go on the Mac toolbar at the top of the screen.
  2. A context menu will pop up. There, click the Applications button.
  1. On the Applications window, scroll down to find the Python 3.12.0 folder.
  2. Right-click to show the context menu.
  3. There, click on the Move to Bin option.
  1. Authenticate the action by using your Touch ID or Mac passcode.

That’s it! You’ve successfully uninstalled Python from your Mac.

Uninstall the Python Framework From Mac

  1. Launch the Mac Terminal app from the Spotlight or Launchpad > Utilities.
  2. In the command line interface, copy and paste the following command:
sudo rm -rf /Library/Frameworks/Python.framework
  1. Enter the Mac passcode to authenticate the action.
  1. Now, run the following command to validate if Python has been uninstalled or not:
python --version

The above method works only if Python is installed by Apple as a part of the macOS setup.

Uninstall Python Using Homebrew

If you installed Python 3.X.X edition using Homebrew, you must install a Homebrew command to uninstall Python. Follow these instructions to remove Python:

  1. Launch the macOS Terminal app.
  2. Copy the following command and paste it into the Terminal app:
brew uninstall python
  1. Hit Enter to start the process.
  2. You should see the Uninstalling notation on the Terminal app.
  1. Once done, any and all activities on the Terminal app will stop.
  2. Verify the uninstallation by running this command:
python3 --version
  1. The Terminal app will show the following notation:
zsh: command not found: python


Knowing how to install Python on Mac is a fundamental skill you must know if you want to make a successful career in the programming sector. 

Also, it becomes necessary to install Python 3.X or better on Mac because the dated Macs come with Python 2.7, which isn’t good for Pythoin scripting. Also, the newer Macs don’t contain any pre-installed Python framework so you must install it manually. 

Try any of the above methods you like and enjoy blazing-fast Python scripting on your Mac.

You may also like to learn about the best resources to learn Python for beginners.

Share on:
  • Tamal Das
    Tamal is a freelance writer at Geekflare. He has an MS in Science and has worked at reputable IT consultancy companies to gain hands-on experience with IT technologies and business management. Now, he writes content on popular B2B and B2C IT…
  • Narendra Mohan Mittal

    Narendra Mohan Mittal is a versatile and experienced digital branding strategist and content editor with over 12 years of experience. He is a Gold Medalist in M-Tech and B-Tech in Computer Science & Engineering.


Thanks to our Sponsors

More great readings on Development

Power Your Business

Some of the tools and services to help your business grow.
  • The text-to-speech tool that uses AI to generate realistic human-like voices.

    Try Murf AI
  • Web scraping, residential proxy, proxy manager, web unlocker, search engine crawler, and all you need to collect web data.

    Try Brightdata
  • is an all-in-one work OS to help you manage projects, tasks, work, sales, CRM, operations, workflows, and more.

    Try Monday
  • Intruder is an online vulnerability scanner that finds cyber security weaknesses in your infrastructure, to avoid costly data breaches.

    Try Intruder