Homebrew Python

Posted on  by admin

Question or issue on macOS:

  1. Homebrew Python 3.9
  2. Homebrew Python 3.8

I have been reading a lot of the tutorials around the web and answers on the site about using Homebrew. When it comes to Python though, the advice leaves me with more questions than answers.

Tl;dr TIL pygame is broken using homebrew Python3, so I decided to wipe my shit and start from scratch. I figured I'd give you the quickness on what I did so next time this shit happens to someone, they have a handy reference. Homebrew is a package manager for larger “general purpose” packages, such as Python, SQLite, MySQL, PostgreSQL, or Git. Do not install packages whose languages have package managers of their own. For example, packages written in Python be installed not with Homebrew but with pip, a package manager for Python, and will be explained later.


I understand the how, but none of the answers I have seen so far have really explained the why behind using Homebrew to install Python and what the benefits are to installing Python with Homebrew as opposed to using OS-X installers provided by the Python Foundation?

The newest versions of the installers from Python and the current implementation of PIP seem to be working pretty well, so I would really appreciate any input on my question. I have worked with Python for a while but from more of a tactical, one off problem solving perspective and I am brand new to tools like Brew and version control software such as Git. I am trying to get up the learning curve. Finding an answer to why I would choose to go with a Homebrew install over just heading over to python.org and downloading from them and then using pip to install packages might help me to understand the benefits of a tool like Homebrew.

So I guess, what does Homebrew give me that going through the installation put in place by TPF does not?

Are there advantages/disadvantages to where Homebrew installs Python and Python packages over the /Library/Frameworks/ and the site-packages folder within that framework?

Though this last question is too broad and likely out of scope, if anyone would also address or provide a link to a good answer on what the benefits are of using Homebrew in general, I’d appreciate it?

Thank you,

How to solve this problem?

Solution no. 1:

The big advantage of using a package manager like Homebrew is it makes it easier to keep your Python installation up to date. If you download Python from the website, then to update it means you’ll need to go back to the website and download a new copy of Python (or whatever it is that you need to update that could have been installed with Homebrew).

Also, when downloading installers, I find they tend to clutter up my downloads folder and require me to periodically clean up unused files. I’d rather spend my time coding instead of managing my disk space usage.

Homebrew Python 3.9

When it comes to updating any package with Homebrew, the command is simple:

And this will update all outdated packages that you installed with Brew.

Homebrew Python 3.8

Now, this isn’t something unique to Homebrew. Macports, PIP, npm, Maven, and other package management tools are also able to manage the versions of modules or tools you install.

For more information, see Safari Books Online – Keeping Your Homebrew Up To Date.

HomebrewHomebrew PythonHomebrew python install

Solution no. 2:

A few reasons not to use system python on OS X from this post,

Apple doesn’t always do a good job on keeping the Python runtime environment up to date,
it can be cumbersome to play with permissions just to install third-party Python libraries,
finally, Apple has a tendency to wipe-out your site-packages with every major OS upgrade.

Homebrew python 3.7

The use of an independent package manager for Python modules, such as Homebrew, conda, Macports, ets. is thus preferred.

Hope this helps!