r/learnpython • • 5d ago

updating Python on macOS

How do you update Python on macOS? I looked it up and from what I can tell, there is no simple command you can enter into the terminal to update it, and you have to instead go to the website https://www.python.org/downloads/ and download and install it manually to update which is inconvenient. There's also the question of removing the old versions you have no intention of using anymore.

I am aware of Homebrew and I do have it for other things I've installed, but I want to try to only use it to download things to my MacBook that I otherwise couldn't. Python can easily be downloaded for mac separately and I want to keep it that way if possible. Is there no update command for the mac terminal to simply update Python?

10 Upvotes

30 comments sorted by

View all comments

13

u/Classic_Mammoth_9379 5d ago edited 5d ago

Why are you setting arbitrary constraints for yourself? 

This is easy on most Linux distributions by using a package manager like yum or apt. 

The most popular package manager on macOS is homebrew and you’ve already got it installed. “brew upgrade python”. 

1

u/Timely-Bend2056 4d ago

does brew actually clean up the old python versions automatically when you upgrade, or do you still have to run a cleanup command after

2

u/xenomachina xenomachina 4d ago

Old patch versions get cleaned up automatically after brew upgrade (via brew cleanup). New minor versions are separate formulae (python@3.12, python@3.13), so they're kept side by side, since minor versions aren't binary-compatible and other formulae may depend on a specific one. brew autoremove removes old versions that were not manually requested and that no installed homebrew packages depend on. For manually requested old versions you need to brew uninstall python@3.x.

Either way, this breaks any venvs built on that version. (Another reason to use uv and have it manage its Python installs, imho.)

-7

u/silverknife42 5d ago

because i dont like using 3rd party programs or websites to download things. i always try to download from source

2

u/Classic_Mammoth_9379 5d ago edited 5d ago

Surely python.org is a 3rd party to you just in the same way homebrew is? What is it that you don't like about it... given that it gives you the result you want in the fashion you asked for?

2

u/xenomachina xenomachina 4d ago

I think that, by OP's reasoning, OP and python.org are the first and second party, while homebrew is a third party. An (unnecessary?) middle man, in a sense.

That said, I agree with you. If you want a quick command line way to install and update python, homebrew is the de facto solution on macOS.

1

u/silverknife42 2d ago

I think that, by OP's reasoning, OP and python.org are the first and second party, while homebrew is a third party. An (unnecessary?) middle man, in a sense.

exactly this. its not at all that i dont trust homebrew or anything, its that i want to keep the management of my applications consistent for myself. i'm still new to and not very good at using the terminal and homebrew is purely on the terminal. its the reason why i avoided getting it for years.