Restoring Python 2 on macOS 12.3 and Higher
With just two simple commands
2 min read
Just a very quick post today! I will be writing some more detailed posts about various topics soon, but things have been so busy over at CircleCI recently.
Apple recently released macOS 12.3 and, in the process, removed Python 2 from macOS entirely. Python 2 has been deprecated, and EOL, for a number of years now (Homebrew deleted the formula some time ago), so the removal of it from the base OS is no real surprise.
As always, I would encourage everyone to migrate to Python 3 for better long-term support, but if you have scripts that absolutely must use Python 2, then this can be added back to macOS in a couple of commands.
Adding Python 2 back to macOS
The Python project still host the final Python 2 macOS installer package, so we can simply download and install this to restore Python 2 to macOS. It is simple and quick to do this entirely from the command line:
curl -O https://www.python.org/ftp/python/2.7.18/python-2.7.18-macosx10.9.pkg sudo installer -pkg python-2.7.18-macosx10.9.pkg -target /
It is as simple as that. Python 2 will now be available again via the
python command and will live happily side by side with the system Python 3 installation (which is the
This also works in CircleCI, where Python 2 is no longer available from Xcode 13.3 onwards: