Skip to main content How to set up python on a new Mac? : r/learnpython
r/learnpython icon
Go to learnpython
r/learnpython
[deleted]

How to set up python on a new Mac?

I got the new Mac mini m4 and I want to get a better understanding of how to setup python correctly.

I want to install python with as minimal bloatware as possible, and preferably finally understanding things like virtual environments. But I will be using python for big coding projects. Based on this, what is the best approach?

Previously I have coded on an older Mac using things like Spyder, and jupyternotebook. It all felt like a huge mess, I never used python in the terminal. I never got comfortable with pip and I never knew if I had to use pip to install packages, since most packages seem to be preinstalled when using Spyder or jupyternotebook.

I started to look up some YouTube tutorials and online, but many sources suggest different setups like rye or home-brew...


26 comments

The fact that there's like 4 different answers including some that contradict the other is why programming is shit for beginners.

6

Yes...this opensource stuff is a royal pain in the ass to people who didn't grow up doing it. That is for damn sure. And help pages make it seem like its just oh so trivial to know what the hell they are talking about....

Personally I just went with Anaconda and use spyder from there. I like more of an all in one solution....and it has 90+ percent of all the packages I need included with the install.

3
Continue this thread

preferably finally understanding things like virtual environments...  I never got comfortable with pip and I never knew if I had to use pip to install packages

I don't have a Mac but from what I gather, you are answering your own question here. Simply using venv + pip should be enough for most purposes, and there's not a ton to learn about it, just the basic commands to create ( ‘python3 -m venv venv’) and then activate (./venv/bin/activate). Then with your venv active you can `pip install whatever` without messing up your OS.

Personally if I need to do anything where that's not enough, I turn to Docker. If you use VS Code, maybe checkout their devcontainers tutorial... but again, only if you really have a specific reason to.

2
Continue this thread

Last year I switched from basic venv to pyenv. I like the way it handles the python installs and virtual environments together. I find the commands more intuitive, and it’s easy to control the Python version per project.

2
Continue this thread

pretty sure python is already installed

1
[deleted]

i dont think python is preinstalled on the newest Macs, and I also don't think the preinstalled version would be helpful

2
Continue this thread

Apple removed python from the default because ppl would add dependencies and mess up the base install causing their own scripts to fail.

So now you have to install an independent version. Idk if Apple completely removed the base python or just limits it to only the OS usage.

2
Continue this thread
Korbit’s AI-Powered Code Review Agent helps your team ship better code, faster.
Thumbnail image: Korbit’s AI-Powered Code Review Agent helps your team ship better code, faster.

Don't use homebrew, homebrew will install a version of python that applies globally, and in my experience doesn't have great multi-version support. Use a tool like uv or pyenv to manage versions and dependencies local to your projects. And you don't want to mess with system python or override it, that can break things.

1
Continue this thread

Use homebrew to install pyenv.

Use pyenv to install the version of Python you want. Then create the virtualenvs using that version of Python.

Alternatively, uv is shaping up nicely to be a replacement for most of the pyenv/venv/pip toolchain. Again, install it using homebrew.

1
Continue this thread

So I just got a new MacBook Air and this is how it went for me. YMMV

My preferred editor is VSCode because I don’t just do python.

  • installed VS Code

  • Tried ro install the Python extensions.

  • Apple from my understanding worked to separate OS dependencies from coding dependencies to reduce the case of programmers borking their systems. So the extensions triggered the download of the core coding tools. This gives you a base python install and other development tools in the background.

  • Note that the Apple python version is older, but that’s fine, it’s stable, only there for the extensions, and not what I use to code in. That is defined by UV.

  • Downloaded the standalone UV package manager. Just started using it and love it. Replaces pip, venv etc There are a lot of videos on how to use it. But keeps things very clean by default.

1