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
export PATH="/usr/local/opt/python@2/libexec/bin:$PATH" Homebrew names the executable python2 so that you can still run the system Python via the executable python. $ python -V # Homebrew installed Python 3 interpreter (if installed) $ python2 ...
🌐
GitHub
gist.github.com › rcackerman › 3920028
Installing/updating Python 2.7 with Homebrew · GitHub
February 5, 2021 - Visit http://xquartz.macosforge.org/trac/wiki and download and install 2.7.5+. ... You may have to use sudo for this command. ... Mountain Lion will still use the system-installed python, in /usr/bin.
🌐
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:
🌐
Medium
medium.com › @liwp.stephen › install-python-2-7-on-mac-b09f05c43ab7
Install python 2.7 on mac - Stephen Lee - Medium
June 28, 2022 - But sometimes, there are still some tools we used daily still needs python 2.7. When search from network, we will find that install python 2.7 with brew with the command: brew install python@2 , but this command also failed right now.
🌐
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 › codeflare
install python 2 7 mac brew - YouTube
Download this code from https://codegive.com As of my last knowledge update in January 2022, it's important to note that Python 2.7 is officially unsupported...
Published: February 5, 2024
Views: 16
Find elsewhere
🌐
GitHub
gist.github.com › samuelbradshaw › 932d48ef1eff07e288e25e4355dbce5d
Installing Python 2 and 3 on macOS · GitHub
These instructions allow you to set up Python 2 and Python 3 side-by-side using pyenv. The instructions were tested on an Apple Silicon Mac, but the process on an Intel Mac should be similar. 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
🌐
Zaiste
zaiste.net › posts › installing-python-27-macos-homebrew
Installing python 2.7 on osx with homebrew · Zaiste Programming
April 30, 2012 - #MacOS · 2012-04-30 · 1 min read · Installing Python with Homebrew may have some quirks. Keep reading to see how to do it the right way. Let's start by updating Homebrew repository · brew update · then we install Python (2.7 in my case) brew install python ·
🌐
Tericcabrel
blog.tericcabrel.com › install-python2-on-macos
How to install Python 2 on Mac OS 12.3 and higher
December 21, 2022 - If you try to install Python 2 ... site. At the moment I'm writing this, the latest version is 2.7.18. Go to the download link and select the MacOS version....
🌐
Ahmad Awais
ahmadawais.com › home › python not found on macos | install python with brew | fix $path
Python not found on MacOS | Install Python with brew | Fix $PATH
June 12, 2023 - Now if you were to install the ... with lot less AI slop. try it free→ ... Not ideal, I know. Pre-requisite: Make sure brew is installed....
🌐
Stack Abuse
stackabuse.com › install-python-on-mac-osx
Install Python on Mac OSX
December 21, 2015 - Now, keep in mind that Mac OSX (10.8) already comes with Python 2.7 pre-installed, so these instructions will only really be helpful if you need to upgrade versions or need a better way to manage installations (like with Homebrew).
🌐
The Hitchhiker's Guide to Python
python-docs.readthedocs.io › en › latest › starting › install3 › osx.html
Installing Python 3 on Mac OS X — The Hitchhiker's Guide to Python
At this point, you have the system Python 2.7 available, potentially the Homebrew version of Python 2 installed, and the Homebrew version of Python 3 as well.
🌐
iBoysoft
iboysoft.com › home › how to tips › how to install python on mac in 2024 [two ways covered]
How to Install Python on Mac in 2024 [Two Ways Covered]
November 27, 2025 - In this article, we'll walk you through the different ways to install the latest version of Python onto a Mac in detail. OK, without further ado, let's get started! Actually, for many years, Python 2.7 is pre-installed on Mac (it is outdated and no longer maintained though).
🌐
freeCodeCamp
freecodecamp.org › news › python-version-on-mac-update
How to Install Python 3 on Mac – Brew Install Update Tutorial
April 6, 2021 - This version is included in macOS ... versions of macOS will not include Python 2.7. Instead, it is recommended that you transition to using 'python3' from within Terminal. Until Apple decides to set Python 3.x, as the default you're going to ...