If you have upgraded to MacOs Sequoia like I did and found out that pyenv and other Python stuff doesn’t not work ( including compiling ) this is for you.
I spent way too much time trying to get Sequoia to install Python properly with pyenv and compiling and installing a binary ( when available ). So I took the logical (?) approach and installed UTM, installed an M1 vm and compiled from scratch to get the binaries and then installed those on my Sequoia Mac and its working.
Here are my steps. Feel free to tell me I am wrong about something and I could have done better.
xcode-select --install
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)
(echo; echo 'eval "$(/opt/homebrew/bin/brew shellenv)"') >> /Users/leon/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
mkdir dev cd dev curl -O https://www.python.org/ftp/python/3.10.14/Python-3.10.14.tgz tar -xvf Python-3.10.14.tgz cd Python-3.10.14
./configure --prefix=/usr/local/python3.10 \ --enable-optimizations \ --with-openssl=$(brew --prefix openssl) \ CPPFLAGS="-I$(brew --prefix openssl)/include -I$(brew --prefix readline)/include -I$(brew --prefix sqlite)/include -I$(brew --prefix zlib)/include" \ LDFLAGS="-L$(brew --prefix openssl)/lib -L$(brew --prefix readline)/lib -L$(brew --prefix sqlite)/lib -L$(brew --prefix zlib)/lib"
make -j4
sudo make altinstall
/usr/local/python3.10/bin/python3.10 --version
mkdir -p python_pkg/usr/local cp -r /usr/local/python3.10 python_pkg/usr/local/
pkgbuild --root python_pkg --identifier com.example.python3.10 --version 3.10.14 --install-location python-3.10.14.pkg
pkgutil --check-signature python-3.10.14.pkg
scp python-3.10.14.pkg you@your_M1_Mac_Ip:~/Downloads
cd ~/dev curl -O https://www.python.org/ftp/python/3.11.9/Python-3.11.9.tgz tar -xvf Python-3.11.9.tgz cd Python-3.11.9
./configure --prefix=/usr/local/python3.11 \ --enable-optimizations \ --with-openssl=$(brew --prefix openssl) \ CPPFLAGS="-I$(brew --prefix openssl)/include -I$(brew --prefix readline)/include -I$(brew --prefix sqlite)/include -I$(brew --prefix zlib)/include" \ LDFLAGS="-L$(brew --prefix openssl)/lib -L$(brew --prefix readline)/lib -L$(brew --prefix sqlite)/lib -L$(brew --prefix zlib)/lib"
make -j4
sudo make altinstall
/usr/local/python3.11/bin/python3.11 --version
mkdir -p python_pkg/usr/local cp -r /usr/local/python3.11 python_pkg/usr/local/
pkgbuild --root python_pkg --identifier com.example.python3.11 --version 3.11.9 --install-location python-3.11.9.pkg
pkgutil --check-signature python-3.11.9.pkg
scp python-3.11.9.pkg you@your_M1_Mac_Ip:~/Downloads
brew install pyenv
curl https://pyenv.run | bash
export PATH="$HOME/.pyenv/bin:$PATH" eval "$(pyenv init --path)" eval "$(pyenv init -)" source ~/.zshrc
mkdir -p
ln -s /usr/local/python3.10
pyenv rehash
pyenv global 3.10.14 OR 3.11.9
python --version
You would think this is it but you still need to know that there is a default install of Python so if you have created a new vent and get errors because your script does not use the venv version OR the pyenv version, you need to find the default version and add your packages there. Cloud cli is one of the apps I use which required me to install a bunch of packages there.
cd /Library/Frameworks/Python.framework/Versions/3.11
bin/pip3 install --force-reinstall --no-binary :all: certifi cffi crcmod cryptography google-crc32c grpcio pycparser pyOpenSSL setuptools
The python community and apple will have this fixed by the time it’s released I am sure but I hope this helps you now.
Leon