Skip to content

Instantly share code, notes, and snippets.

@villasv
Last active October 21, 2022 01:04
Show Gist options
  • Save villasv/e6f688f3b44f838a2ba7506958df5724 to your computer and use it in GitHub Desktop.
Save villasv/e6f688f3b44f838a2ba7506958df5724 to your computer and use it in GitHub Desktop.
Rosetta Python Setup
### x86
# Install Rosetta
softwareupdate --install-rosetta
# Install Homebrew
arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
alias brew86="arch -x86_64 /usr/local/bin/brew"
# Install Pyenv
brew86 install bzip2 gettext openssl readline sqlite3 xz zlib tcl-tk
brew86 install pyenv
alias pyenv86="arch -x86_64 pyenv"
### Python
# Ensure the compiler uses the x86 libraries
export FLAGS="-I$(brew86 --prefix)/include"
export LDFLAGS="-L$(brew86 --prefix)/lib"
# Ensure the compiler uses OpenSSL 1.1.x
export FLAGS="$FLAGS -I$(brew86 --prefix openssl@1.1)/include"
export LDFLAGS="$LDFLAGS -L$(brew86 --prefix openssl@1.1)/lib"
# Install Python 3.7 (and any other versions you might want)
pyenv86 install -v 3.7.9
### ARM
# Install Homebrew
curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh
# Install Pyenv
brew install bzip2 gettext openssl readline sqlite3 xz zlib tcl-tk
brew install pyenv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment