DEV Community

Cover image for Python 2.7 was removed from macOS in this update and how to fix it
Aliaksei Kuncevič
Aliaksei Kuncevič

Posted on • Updated on

Python 2.7 was removed from macOS in this update and how to fix it

I was quite surprised this morning to find out that some of my apps stopped working. All of them rely on Python 2.

Who deleted my Python?

It took me a moment to realize that a new Mac OS 12.3.1 was installed overnight, so I thought it might be a reason.
And here it is.

Python 2.7 was officially gone from the system. Starting from version 12.3 Apple is not going to ship this version of Python anymore as a part of Mac OS.

Python 2.7 was removed from macOS in this update. Developers should use Python 3 or an alternative language instead.

The reason is that Python 2.x no longer maintained

However apps that rely on Python 2.x are tightly coupled with that version so having Python 3 won't really help.

So how would you fix it?

Here are a few simple steps that I followed.
First, install Homebrew if you haven't got it installed yet. Make sure that it works.

Now we need to get pyenv. Pyenv is a Python version manager that will help to manage Python versions. Once pyenv installed we needed to configure Python 2.7, and that is it.

Here are the terminal commands for that.

brew install pyenv
pyenv install 2.7.18
ln -s "${HOME}/.pyenv/versions/2.7.18/bin/python2.7" "${HOMEBREW_PREFIX}/bin/python"

Additionally you can set the Python2.7.18 as global by running this command:

pyenv global 2.7.18

So, with these simple steps now I’ve got Python 2 back on my system and I hope this article will help someone too.

My name is Aliaksei Kuncevič. I am teaching Angular and Web Technology. Helping dev teams to adopt Angular in the most efficient way. GDE, member of the NGXS Core Team.

Thanks for reading, and ask your questions in the comments or contact me directly via linkedin or DM me on twitter

I hope you find this content helpful and if so, please help to spread this article so more people can benefit from it.

Additionally you may want to checkout my podcast where I am sharing cool tips and insights about Angular and interviewing an awesome guests 🎙

Top comments (0)