You can use pyenv to install python with:

brew install pyenv
pyenv install 2.7.18

Optionally set it to your global default:

pyenv global 2.7.18

Nice article on why using pyenv is better than using brew to manage your python installation.

To make python binary available globally, add shims to PATH:

PATH=$(pyenv root)/shims:$PATH
Answer from donturner on Stack Overflow
🌐
The Hitchhiker's Guide to Python
docs.python-guide.org › starting › install › osx
Installing Python 2 on Mac OS X — The Hitchhiker's Guide to Python
$ brew install python@2 · Because python@2 is a “keg”, we need to update our PATH again, to point at our new installation: export PATH="/usr/local/opt/python@2/libexec/bin:$PATH" Homebrew names the executable python2 so that you can still ...
🌐
GitHub
gist.github.com › samuelbradshaw › 932d48ef1eff07e288e25e4355dbce5d
Installing Python 2 and 3 on macOS · GitHub
Homebrew is a popular package manager that makes it easy to install command line tools. If you don’t yet have Homebrew installed, instructions can be found here: https://brew.sh
🌐
DEV Community
dev.to › jordicuevas › how-to-install-python2-in-a-macbook-m1-with-brew-bhi
How to install python2 in a macbook M1 with brew - DEV Community
May 23, 2022 - First of all , you should have installed brew. ... After the installation of pyenv we can now proceed to install the required python version we need with the following command: ... After restarting my shell and try to install the dependencies of the project I found one more time there is not a python2 executable , but you are wondering what I did wrong?
🌐
Medium
medium.com › @yangnana11 › installing-python-2-on-mac-os-x-d0f1c9c4d808
Installing Python 2 on Mac OS X. While OS X comes with a large number of… | by Yang Nana | Medium
April 30, 2018 - $ brew install python@2 · Because python@2 is a “keg”, we need to update our PATH again, to point at our new installation: export PATH="/usr/local/opt/python@2/libexec/bin:$PATH" Homebrew names the executable python2 so that you can still ...
🌐
Mac Install Guide
mac.install.guide › python › brew
Brew Install Python · Mac Install Guide
February 25, 2024 - You may wish to install a specific version of Python using Homebrew. For example, Python 3.15 may be the newest version installed by Homebrew but you need to work on an application that requires Python 3.7. You can use brew search python to see if an earlier Python version is available.
🌐
TestMu AI Community
community.testmuai.com › ask a question
How to reinstall Python 2 using Homebrew? - Ask a Question - TestMu AI (formerly LambdaTest) Community
January 1, 2025 - This way, you can switch between Python versions as needed, while still installing dependencies with brew install python2 when required.
Find elsewhere
🌐
Tericcabrel
blog.tericcabrel.com › install-python2-on-macos
How to install Python 2 on Mac OS 12.3 and higher
December 21, 2022 - Python 2 has been removed since MacOS 12.3 and also from Homebrew. In this post, I show how to install Python 2.7 on MacOS Monterrey and higher.
🌐
GitHub
gist.github.com › pithyless › 1208841
Install Python 2.7 (homebrew + pip + virtualenv) on Mac OS X Lion · GitHub
$ brew install readline sqlite gdbm $ brew install python --universal --framework $ python --version Python 2.7
🌐
YouTube
youtube.com › watch
How to Install Python on macOS using Homebrew - YouTube
In this tutorial, I'll walk you through how to properly install Python on macOS using Homebrew. We'll bypass the default system Python to keep your Mac clean...
Published: March 29, 2026
🌐
Homebrew
formulae.brew.sh › formula › python@3.14
Homebrew Formulae: python@3.14
Install command: brew install python@3.14 · Interpreted, interactive, object-oriented programming language · https://www.python.org/ License: Python-2.0 · Development: Pull requests · Formula JSON API: /api/formula/python@3.14.json · Formula ...
🌐
YouTube
youtube.com › watch
How to Install Python on Mac (Homebrew) - YouTube
Install Python with Homebrew → brew install pythonIn today's video, I'll show you how to install Python with Homebrew. Homebrew makes it easy to install and ...
Published: May 14, 2022
🌐
GitHub
github.com › microsoft › vcpkg › issues › 24190
`brew install python2` · Issue #24190 · microsoft/vcpkg
April 16, 2022 - ➜ vcpkg git:(master) ✗ brew install python2 Running `brew update --preinstall`... ==> Auto-updated Homebrew! Updated 2 taps (homebrew/core and homebrew/cask). ==> Updated Formulae Updated 39 formulae.
Author: microsoft
🌐
freeCodeCamp
freecodecamp.org › news › python-version-on-mac-update
How to Install Python 3 on Mac – Brew Install Update Tutorial
April 6, 2021 - MacOS comes with Python pre-installed. But it's Python Version 2.7, which is now deprecated (abandoned by the Python developer community). The entire Python community has now moved on to using Python 3.x (the current version as of writing this is 3.9...
🌐
Bioinformatics Answers
biostars.org › p › 9597971
Is there a way to install Python version 2 on Mac with M3 chips?
June 29, 2024 - This is how I installed python2 on my MacOS Sonoma (14.5) with M3 chips. brew install pyenv · pyenv install 2.7.18 · pyenv init, and follow instructions to append the following to ~/.zprofile and ~/.zshrc ·
🌐
Homebrew
formulae.brew.sh › formula › python@3.12
Homebrew Formulae: python@3.12
Install command: brew install python@3.12 · Interpreted, interactive, object-oriented programming language · https://www.python.org/ License: Python-2.0 · Development: Pull requests · Formula JSON API: /api/formula/python@3.12.json · Formula ...
🌐
GitHub
gist.github.com › 3920028
Installing/updating Python 2.7 with Homebrew · GitHub
In XCode's Preferences > Downloads ... raw.github.com/mxcl/homebrew/go)" You may have to use sudo for this command. brew install python --framework --universal ·...