Skip to content

Instantly share code, notes, and snippets.

@brandon-braner
Last active December 16, 2021 15:09
Show Gist options
  • Save brandon-braner/a51ab04c0c0f35f0fa64ca57428aa387 to your computer and use it in GitHub Desktop.
Save brandon-braner/a51ab04c0c0f35f0fa64ca57428aa387 to your computer and use it in GitHub Desktop.
Get pyenv working on M1

Tested on M1 Max on MacOS Monterey in Parallels

Install homebrew /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Install pyenv

brew update brew install pyenv

Add the following to ~/.zprofile

If you don't have a .zprofile touch ~/.zprofile

Add the following to you ~/.zprofile

eval "$(pyenv init --path)"

Add the following to your ~/.zshrc

eval "$(pyenv init --path)"
eval "$(pyenv init -)"

Install a Python version

pyenv install 3.9.9

Set the global version pyenv global 3.9.9

Source the profile for good measure

source ~/.zshrc

Check Python version

python -V Python version should now be 3.9.9

which python That should return something like `your/home/.pyenv/shims/python

@mikeckennedy
Copy link

Thanks for this Brandon. I think I generally got it working too. Although, I had to do a rosetta install of python 3.9.9 with pyenv to get it to compile. But I think this might be because my homebrew is rosetta from the early days of M1. I'll give it a try on the laptop which has none of that confusion in it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment