Modernizing Your Mac: How to Update Python via Terminal

Harold Sep 19, 2026

Updating Python on your Mac terminal is a straightforward process that ensures you benefit from the latest features. Here's a step-by-step guide to keep your Python version up-to-date.

How to Customize the Mac Terminal and Make It More Useful
How to Customize the Mac Terminal and Make It More Useful

Before diving into the update process, let's briefly discuss the importance of keeping Python current. Regular updates bring bug fixes, performance improvements, and new libraries that can enhance your coding experience and projects.

an image of a computer screen with the program's name and numbers displayed on it
an image of a computer screen with the program's name and numbers displayed on it

Using Homebrew

Homebrew is a popular package manager for macOS, making it easy to install and maintain Python. If you haven't installed Homebrew yet, you can do so using the following command in your terminal:

a black computer screen with some text on it
a black computer screen with some text on it

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Installing or Updating Python via Homebrew

How to Update Python on Windows, Mac, & Linux – Easy Guide | Coding Framework
How to Update Python on Windows, Mac, & Linux – Easy Guide | Coding Framework

Once Homebrew is installed, you can use it to install or update Python. To update Python, simply run:

brew upgrade python

This command will ensure you have the latest version of Python available in the Homebrew repository. If you want to install Python for the first time, use:

6 Fun and Cool Mac Terminal Commands to Try
6 Fun and Cool Mac Terminal Commands to Try

brew install python

Switching Between Python Versions

Homebrew installs Python in such a way that you can easily switch between different versions. To list the installed Python versions and their states, use:

macOS 27 Has a Hidden LLM Inside — 10 (Amazing) Things You Can Do With It
macOS 27 Has a Hidden LLM Inside — 10 (Amazing) Things You Can Do With It

brew list python

To switch to a specific version, use the following command, replacing 'python@3.9' with your desired version:

5 Useful Terminal Tricks for Mac Users — WIRED
5 Useful Terminal Tricks for Mac Users — WIRED
How to Update Your Mac Using Terminal - Make Tech Easier
How to Update Your Mac Using Terminal - Make Tech Easier
How To Use Terminal On Your Mac
How To Use Terminal On Your Mac
Mac Terminal  10 Awesome Commands
Mac Terminal  10 Awesome Commands
How to Change Read, Write Permissions on Mac Terminal: A Complete Guide - Apple Gazette
How to Change Read, Write Permissions on Mac Terminal: A Complete Guide - Apple Gazette
The Zen of Python
The Zen of Python
How to Install Python 3.13.7 on macOS Monterey to macOS 26 Tahoe
How to Install Python 3.13.7 on macOS Monterey to macOS 26 Tahoe
python 😭
python 😭
Python tuple update tutorial infographic
Python tuple update tutorial infographic

brewservices start python@3.9

Using pyenv

pyenv is another powerful tool that allows you to easily switch between multiple Python versions. It's particularly useful when you need to work on projects that require specific Python versions.

Installing pyenv

To install pyenv, first, install the following dependencies:

brew install openssl readline gdbm

Next, clone the pyenv repository from GitHub:

git clone https://github.com/pyenv/pyenv.git ~/.pyenv

Using pyenv to Manage Python Versions

With pyenv installed, you can now list, install, and switch between Python versions effortlessly. To see the installed versions, use:

pyenv installed

To install a new version, simply run:

pyenv install 3.9.7

To switch to the installed version, use:

pyenv shell 3.9.7

Staying updated with the latest Python versions not only ensures you benefit from new features but also helps avoid potential security issues. Keep your Python versions current, and happy coding!