It's Fred

1337

How to quickly install modern Python versions on a Mac (including M1 Macs)

December 28, 2020 - 2 min read

Use this bash two-liner for installing a minimal Python 3 distribution (Miniforge) anywhere you need an up to date Python distribution on a Mac (including M1 Macs).

After trying various installation methods the past few years, Miniforge wins out on “just works” when it comes to installing an up to date Python distribution on a Mac (including M1 Macs):

brew install miniforge
conda init

For changes to take effect, close and re-open your current shell.

Next steps

Only one Python version is available “by default” in new terminal windows (eg 3.9). Use the conda command to install any version of Python 3 (3.7, 3.8, etc) independently of each other.

Eg if you want to run Python 3.10:

conda update -n base -c defaults conda # once, to make sure Python 3.10 is available
conda create -n python310 python=3.10 # once per python version
conda activate python310 # every time you want to access Python 3.10 in a terminal

Note that use of Miniforge does not require you to use conda to install and maintain all packages. Feel free to use venv “as usual”. Conda is just a clean way of installing Python (and it’s various versions) cleanly on a Mac as per above.


Fred

Fred is a Nordic software engineer who once set out never to blog in his life, but then thought better of it. You should follow him on Twitter