Python

Written & tested for accuracy by a developer (not AI)

How to Install Python on Mac

How to install Python on a Mac. Install Python with Homebrew in one command, or install uv for Python development. Which installation method to choose.

The short answer: if you just need Python on your Mac, install it with Homebrew in one command. If you are going to write Python code, install uv instead. It installs Python for you and manages versions, packages, and virtual environments in one tool.

Do not use the system Python. Python does not come with macOS: Apple installs Python 3.9.6 as part of the Xcode Command Line Tools, for its own utilities. It is old, it has restricted permissions, and installing packages into it creates a mess that is hard to undo. Check what Python you already have before you install anything.

Installing Python is one step in setting up your Mac for software development. See the complete guide to set up a Mac for software development.

Before you get started

You'll need a terminal application to install Python. Apple includes the Mac terminal but I prefer Warp Terminal. Warp is an easy-to-use terminal application, with AI assistance to help you learn and remember terminal commands. Download Warp Terminal now; it's FREE and worth a try.

The fastest way: install Python with Homebrew

If you already use Homebrew, or you just want a working Python without thinking about it, this is the shortest path:

$ brew install python

That is all it takes. Homebrew installs the current Python and puts it on your PATH.

One wrinkle worth knowing: Homebrew gives you a python3 command but not python. Both run the same Python 3, and one extra $PATH step gives you python as well. See Differences between python and python3 for why, and Install Python with Homebrew for the step.

Homebrew Python is a good fit for running simple scripts and for casual use. It has one real limitation worth knowing up front: Homebrew updates Python on its own schedule, so a brew upgrade can move your Python version out from under a project. That does not matter for a one-off script. It matters a lot for a codebase you are maintaining.

The best way for development: install Python with uv

If you are writing Python, install uv. This applies to anything with dependencies and anything you will come back to. It installs Python itself, so you do not need to install Python first, and it replaces pip, pipx, virtualenv, pyenv, and poetry with a single tool.

$ curl -LsSf https://astral.sh/uv/install.sh | sh
$ uv python install

uv pins a Python version per project and creates a virtual environment for each one automatically. That is what keeps two projects with conflicting dependencies from breaking each other.

The other ways to install Python

These are worth knowing so you can tell whether a tutorial you are following is giving you good advice.

  • Pipx installs stand-alone Python applications (such as ruff or youtube-dl) in isolated environments. Use it when you want to run a Python program, not write one. uv covers this too, with uv tool install.
  • Pyenv is a Python version manager only. Choose it if you specifically want the traditional toolchain of Pyenv plus venv plus pip, which many older tutorials assume. You'll manage environments and packages yourself.
  • The official python.org installer works, but most Mac developers avoid it. It adds files to /usr/local/bin, modifies your PATH, and installs into /Library/Frameworks, which is awkward to clean up later.
  • The macOS system Python is not for you. See Mac system Python.

Which one should you pick?

Match your situation to a tool:

  • Just get Python working - install with Homebrew
  • Write Python code - install uv
  • Run a Python app or command-line tool - install Pipx, or use uv tool install
  • Switch versions with traditional tools - install Pyenv

If you are not sure, install uv. It covers every case above and is the easiest to back out of.

After you install

  1. Confirm which Python you are running with which -a python python3 and python3 --version. If that is not what you expect, or the python command is missing entirely, your Mac PATH for Python needs attention.
  2. If you plan to install packages, do it inside a virtual environment. uv does this for you. With other methods you'll use venv and pip.

Common errors

Want the background?

For how Python's version managers, package managers, and virtual environments fit together, and why Python needs so many of them, see Python on Mac.

Continue setting up your Mac

Don't miss the full visual roadmap and checklist that shows how to set up a Mac for software development, with all the essential tools and settings you might not yet know about.