New to Homebrew and can't install Python2

Hi there,

I just installed Homebrew on my Mac (Mojave 10.14.6). When I run $ brew doctor, I get the successful response “Your system is ready to brew.” so I believe everything installed correctly.

However, when I run $ brew install python2, I get the following response:

*Error: No available formula with the name “python2” *

==> Searching for a previously deleted formula (in the last month)…

Error: No previously deleted formula found.

==> Searching for similarly named formulae…

Error: No similarly named formulae found.

==> Searching taps…

==> Searching taps on GitHub…

Error: No formulae found in taps.

Am I missing a key part of the command? Any help with this would be greatly appreciated.

Thank you!

Which is literally true. However, there is a formula named python@2 which installs Python 2.7.17:

$ brew info python@2
python@2: stable 2.7.17, HEAD
Interpreted, interactive, object-oriented programming language
/usr/local/Cellar/python@2/2.7.17_1 (3,806 files, 51.3MB) *
  Poured from bottle on 2019-12-28 at 20:05:00
From: /usr/local/opt/python@2/.brew/python@2.rb

Sorry, just noticed that I’d previously installed it, so Homebrew was looking at that formula instead of the one from the homebrew-core tap, which was deleted just a few days ago:

$ git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core log -- Formula/python@2.rb
commit 028f11f9e40e4812a57e84fb670bbf2f30a60525
Author: Michka Popoff <>
Date:   Mon Feb 10 07:24:50 2020 +0100

    python@2: delete (#49796)
    EOL 1 January 2020.
    We gave it 1 month more to live so that people had time to migrate.
    All in all, developers had 11 years to do their migration.
    You can use the `brew extract` command and maintain python@2 in your own
    tap if necessary:
1 Like

Python 2 is EOL and shouldn’t be used anymore so homebrew removed it. If you do absolutely need to use outdated software, your mac comes with python 2 preinstalled.

Thank you both for your help @SMillerDev and @gromgit!

I am new to this and was just following my predecessor’s instructions. I will make note that Python 2 is EOL.

@SMillerDev Many old software still requires python2 and if you google for this error you’ll find many people (in other languages primarily) trying to figure out how to use python2 with homebrew. Please re-enable it.

We’re not intentionally opening up people to security problems. The world had 10 years to update and didn’t, and we’re not helping to prolong that. If you really need python 2, just use the one Apple ships within macOS.

1 Like

This (removing Python 2) breaks so many things! It is very well to say “use macOS builtin python 2.7” but that does not come with ‘pip’ as far as I can see. I maybe wrong. And no I’m not a Python fan, actually dislike it very much but occasionally I need to run some Python 2 from web and now after this I’ve spent like two hours trying to get a PyQt5 program that uses Python 2 to work. Guys, this was not a great move, who are you to dictate what people can and cannot do.

We’re the people that put in the work to support the software. And we agree with the people that wrote the software on the fact that python 2 shouldn’t be available anymore. I’m not sure what other group should be consulted.

It sucks for you that you have to work with unsupported software, but that’s really not Homebrew’s fault.

How about the consulting the rest of the world who have been seduced to use that contraption called Python?! :wink: What I don’t get is this zealot attitude that people in any sort of power get that they should force their preferences on the rest of the world. Would it have been too much to ask that the old “brew install python@2” would keep working … like until the best part of the world had caught on?

Yes, because to me that would be like handing spoiled/rotten candy to kids on Halloween instead of handing no candy. I’d rather not ship python 2 then shipping software that I know is unsupported by its developers.

It has been over 10 years since the python developers said you should stop using python 2 because it would be going away, keeping it around longer is not going to make any meaningful change except more work for the people making and distributing python for you.

Nothing is stopping you from using brew extract python@2 by the way, you can easily keep your own version around for as long as you want.

So why did nobody say that [extract] in the first place?
And what is the tap, ‘brew extract python@2’ results in “Invalid usage: This command requires at least 2 named arguments.”
Thanks for that, that is good info.

As to my rant: it is not like offering spoiled candy, it is like when a kid asks for rotten candy and you say well there is some at bottom of that trash can.

I don’t get why keeping things as they are makes more work, just leave it be.

And the bottom line is that " I’d rather not ship …" is exactly pushing and enforcing your own preferences and agenda to number of other people.

Your prerogative I guess and I want to thank you all for the great work and homebrew which mostly “just works” which how I want my open source.