Updating Python on Mac
How do you update Python on a Mac? What are the different methods—like Homebrew, the official installer, or pyenv—that you can use to keep Python up to date?
If you’re working on a Mac, you may eventually ask yourself: “How do I update Python on my system?” Since macOS often ships with an older version of Python by default, updating it is important for compatibility with modern libraries and frameworks.
Check Current Version
First, verify what version you have installed:
python3 --version
Method 1: Using Homebrew (Recommended)
Homebrew is the most popular way to manage Python versions on macOS.
brew update
brew install python
If you already have Python installed, simply run:
brew upgrade python
Method 2: Official Python Installer
You can download the latest Python release from the official Python website. The installer will place the new version alongside the system one, so you don’t risk breaking macOS dependencies.
Method 3: Using pyenv (Multiple Versions)
If you need to switch between multiple Python versions, pyenv is a great tool:
brew install pyenv
pyenv install 3.12.5
pyenv global 3.12.5
This sets your chosen version as the global default.
Key Takeaway:
On macOS, avoid modifying the system’s default Python. Instead, use Homebrew or pyenv for safe updates and version management. This ensures you always have the latest Python without interfering with system processes.