How to Install Python on Mac: A Complete Setup Guide
Python doesn't come ready to use on modern Macs — or rather, the version that does come pre-installed is often outdated, restricted, or not meant for development work. Getting a proper Python installation set up involves a few decisions that aren't obvious upfront, and the right path depends heavily on what you're planning to do with it.
Here's a clear breakdown of how the process works, what your options are, and what shapes the outcome for different users.
Why the Pre-Installed Python on Mac Isn't Enough
macOS includes a system Python — historically Python 2.7, and on more recent versions, a stub that prompts you to install Apple's developer tools. Either way, this version is not meant for general development. It exists to support system-level scripts and macOS internals.
If you try to use it for building projects, installing packages, or running modern code, you'll run into version mismatches, permission issues, and conflicts almost immediately. Most developers treat the system Python as off-limits and install a separate, user-controlled version.
The Main Ways to Install Python on Mac
There are three practical installation paths, each suited to different workflows:
1. Direct Download from Python.org
The simplest starting point. You go to python.org, download the macOS installer for the latest stable release, run the .pkg file, and Python is installed.
What this gives you:
- A clean, official Python installation
- The
python3command available in Terminal - IDLE (Python's built-in editor)
- pip (Python's package manager) included
Where it falls short:
- Managing multiple Python versions becomes manual and messy
- It doesn't integrate neatly with version management tools
- Fine for beginners or single-version use; limiting for more complex projects
2. Homebrew
Homebrew is a popular package manager for macOS. Once installed, you can install Python with a single terminal command:
brew install python This places Python in a Homebrew-managed directory, keeps it separate from the system Python, and makes updates straightforward (brew upgrade python).
What this gives you:
- Easy updates
- Cleaner separation from system files
- Integration with other tools developers commonly use
Where it falls short:
- Homebrew manages one "current" version at a time; switching between Python versions still requires extra steps
- Adds Homebrew as a dependency in your workflow
3. pyenv
pyenv is a dedicated Python version manager. It lets you install multiple versions of Python side by side and switch between them per-project or globally.
brew install pyenv pyenv install 3.12.3 pyenv global 3.12.3 What this gives you:
- Full control over which Python version runs where
- Ability to test code across multiple versions
- Works well with virtual environments
Where it falls short:
- Requires a few extra configuration steps (adding pyenv to your shell profile)
- More setup overhead than a simple installer
Setting Up PATH and Shell Configuration
Regardless of which method you use, there's one concept that trips up many first-time installers: the PATH variable.
Your Mac's Terminal looks for commands in specific directories, in a specific order. If the wrong Python ends up first in that path, typing python3 will call the wrong version. Each installation method handles this differently:
- python.org installer adds itself to
/usr/local/binor/Library/Frameworks - Homebrew places Python in
/opt/homebrew/bin(on Apple Silicon Macs) or/usr/local/bin(on Intel) - pyenv inserts a shim directory at the front of your PATH
🔧 On Apple Silicon Macs (M1, M2, M3 chips), Homebrew moved to /opt/homebrew, which isn't always in the default PATH. New users on these machines sometimes install Python successfully but then can't find it in Terminal — this is the usual cause.
To verify which Python your terminal is using after installation:
which python3 python3 --version Virtual Environments: The Step Many Skip
Once Python is installed, the strongly recommended next step is using virtual environments for any project. A virtual environment isolates a project's packages from your system-wide Python installation.
python3 -m venv myproject-env source myproject-env/bin/activate Without this, installing packages globally with pip can cause version conflicts between projects — a problem that's frustrating to untangle later. This applies regardless of which installation method you chose.
How Your Use Case Changes the Right Approach
| Use Case | Recommended Approach |
|---|---|
| Learning Python basics | python.org installer |
| General development, single version | Homebrew |
| Multiple projects, different Python versions | pyenv |
| Data science (Anaconda ecosystem) | conda/Miniconda instead |
| Contributing to open source | pyenv + virtualenv |
Data science workflows often use conda (via Anaconda or Miniconda) rather than any of the above — it manages both Python versions and scientific packages in a way that pip alone doesn't handle as cleanly.
What Determines the Right Setup for You
Several factors shape which installation path makes the most sense:
- Mac chip type — Apple Silicon vs. Intel changes where Homebrew installs files and which binaries are compatible
- macOS version — older macOS releases have different default shells (bash vs. zsh), which affects shell configuration files
- Number of projects — one project with one Python version is very different from juggling five projects that each need different versions
- Technical comfort level — the pyenv path is powerful but assumes some comfort with Terminal and shell configuration
- Existing tools — if you're already using Homebrew for other software, extending it to Python is natural; if not, the overhead may not be worth it
The installation itself is rarely more than a few commands. What varies is how well the setup holds up over time — when you upgrade macOS, start a new project, or need to install a conflicting set of packages. That's where the differences between these approaches really show up, and where your specific situation starts to matter more than any general guide can account for. 🐍