Install the Latest Python on macOS (M1/M2/M3) in Minutes
This step‑by‑step guide shows how to check the pre‑installed Python version on any macOS device, install Homebrew, use it to install the newest Python release, configure PATH, add optional libraries and choose an IDE, with troubleshooting tips for common issues.
Prerequisites
MacBook running macOS (including Intel, M1, M2, M3, M4) with administrator access.
Check pre‑installed Python version
Open Terminal (⌘+Space, type “Terminal”) and run
python3 --version. If a version such as
Python 3.x.xappears, Python 3 is already present; otherwise you need to install it.
If a dialog asks to install the Command Line Tools, click “Install” and wait for the download.
Install Homebrew (macOS package manager)
Run the following command in Terminal:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"Follow the on‑screen prompts, entering your password when requested.
Verify the installation with
brew --version. If an older version is reported, update Homebrew:
brew updateInstall the latest Python via Homebrew
In Terminal run:
brew install pythonWait for the process to finish, then confirm the installed version (e.g., Python 3.13) with:
python3.13 --versionCheck that pip is available:
pip3 --versionAdd Python to PATH (if necessary)
Edit your shell profile (
~/.zshrcfor Zsh or
~/.bash_profilefor Bash) and append:
export PATH="/usr/local/opt/python/libexec/bin:$PATH"Save the file and reload the profile:
source ~/.zshrcVerify the change with
python3 --version.
Install optional Python libraries
Common libraries include NumPy, Pandas, Flask, and Matplotlib. Install any library with:
pip3 install library_nameChoose an IDE (optional)
Beginner‑friendly IDEs: GeeksforGeeks IDE, Visual Studio Code, PyCharm.
Common issues and troubleshooting
“command not found” – ensure Homebrew is installed and Python is on PATH.
Installation incomplete – reinstall with
brew reinstall python.
Homebrew errors – run
brew doctorand follow the suggestions.
FAQ
Run Python in Terminal with
python3and exit with
exit().
Install a specific version (e.g., 3.13) from the official Python website.
Verify installations with
python3 --versionor
pip3 --version.
Python Programming Learning Circle
A global community of Chinese Python developers offering technical articles, columns, original video tutorials, and problem sets. Topics include web full‑stack development, web scraping, data analysis, natural language processing, image processing, machine learning, automated testing, DevOps automation, and big data.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.