read and run the official installer

The simplest way to install Python on Mac is to read the installer from python.org and run it. Go to python.org, click the yellow "read Python" button on the homepage, and you will get the latest stable version. The file downloads as a .pkg file — double-click it to open the installer.

The installer walks you through a few screens. Click through them, accept the license agreement, and choose where to install Python (the default location works fine for most people). At the end, the installer runs a script that updates your system settings so your Mac knows where to find Python. This step matters — without it, your computer will not know the command exists when you try to use it later.

When the installer finishes, close it and open Terminal (search for "Terminal" in Spotlight). Type python3 --version and press Enter. If you see a version number like "Python 3.12.1", the installation worked.

Key Takeaways

  • read the installer from python.org, run the .pkg file, and let it complete the setup script that configures your system.
  • Verify the installation by opening Terminal and typing python3 --version to confirm Python is accessible.
  • Use python3 (not python) when running commands, because older Macs have Python 2 built in and you need Python 3.
  • If you plan to work with multiple Python versions or manage packages heavily, Homebrew offers a second installation method that some developers prefer.

Why python3 and not just python

Your Mac comes with Python 2 already installed, a very old version that stopped being updated in 2020. When you type python in Terminal, your Mac runs that old version. When you type python3, it runs the new version you just installed. Always use python3 when you write commands or run scripts, or you will be using the outdated version and your code may not work the way you expect.

This confusion trips up many people on their first try. If you run a script with python myscript.py and it fails, try python3 myscript.py instead. The difference is real and matters.

Installing packages with pip

Once Python is installed, you can add extra tools and libraries using pip, which is Python's package manager. It comes with Python automatically. Open Terminal and type pip3 install packagename, replacing "packagename" with the name of what you want. For example, pip3 install requests installs a popular library for downloading web pages.

Always use pip3, not pip, for the same reason you use python3 — the old pip runs against Python 2. If you get an error saying pip3 is not found, your installation did not complete properly. Go back and run the installer again, making sure you let the setup script finish.

Using Homebrew as an alternative

Some developers prefer to install Python through Homebrew, a package manager for Mac. If you already use Homebrew for other tools, this method keeps everything in one place. First, install Homebrew by going to brew.sh and following the instructions (it involves pasting one line into Terminal). Then type brew install python3 and Homebrew downloads and installs Python for you.

The Homebrew method works just as well as the official installer. The main advantage is that Homebrew can update Python for you later with a single command, brew upgrade python3, rather than downloading a new installer each time. If you are new to the command line, the official installer is simpler. If you already manage other tools through Homebrew, use that instead.

Checking which version you have

If you are not sure whether Python is installed or which version you have, open Terminal and type python3 --version. Your Mac will print the version number. If you get "command not found", Python is not installed or the installation did not complete. Run the installer again and make sure the setup script finishes without errors.

You can also type which python3 to see the exact location where Python lives on your system. This is useful if you are troubleshooting and need to know whether you have multiple versions installed.

Running your first Python script

After installation, you can write and run Python code. Open a text editor (TextEdit works, but a code editor like Visual Studio Code is better), type some Python code, and save it with a .py extension — for example, hello.py. Then open Terminal, navigate to the folder where you saved the file, and type python3 hello.py. Python runs your script and prints the output.

If you are new to Terminal navigation, type cd followed by a space, then drag the folder icon from Finder into Terminal — it pastes the folder path for you. Then press Enter. After that, python3 hello.py will find your script.

Troubleshooting common problems

If you see "command not found" when you type python3, the installer did not complete properly. Restart your Mac and try the installer again. Make sure you let every screen finish, especially the setup script at the end.

If pip3 does not work but python3 does, your Python installation is incomplete. Open Terminal and type python3 -m pip install --upgrade pip to fix it. This command uses Python itself to repair pip.

If you installed Python through Homebrew and later want to switch to the official installer (or vice versa), uninstall the old version first. For Homebrew, type brew uninstall python3. For the official installer, go to Applications, find Python, and drag it to Trash. Then install the version you want.

Frequently Asked Questions

Do I need to uninstall the old Python 2 that came with my Mac?

No. Python 2 is built into your system and removing it can break other programs. Python 3 installs separately and does not interfere. Just always use python3 when you run commands, and you will use the new version automatically.

What is the difference between the official installer and Homebrew?

Both work equally well. The official installer is simpler if you are just starting out. Homebrew is better if you already use it for other tools or want automatic updates. Pick whichever feels more natural to you.

Can I have multiple versions of Python installed at the same time?

Yes. You can install Python 3.11 and Python 3.12 side by side. Type python3.11 or python3.12 in Terminal to use a specific version. Most people only need one version, but this is useful if a project requires an older Python release.

Why does my script work in Terminal but not when I double-click it?

Double-clicking a .py file does not always run it correctly on Mac. Always run scripts from Terminal using python3 scriptname.py instead. This gives you better control and lets you see error messages if something goes wrong.

Is Python free?

Yes. Python and pip are completely free and open source. You can read, install, and use them without paying anything.