Install psycopg2-binary on Apple M1 Macs
Install psycopg2-binary on an Apple M1 Mac with Homebrew PostgreSQL and OpenSSL. Configure compiler flags and dependencies for the Python database adapter.
-
Update xcode:
xcode-select --install -
Install homebrew:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" -
Install postgresql:
brew install postgresql -
Install openssl:
brew install openssl -
Link openssl:
brew link openssl -
Set up env variables flags:
export LDFLAGS="-L/opt/homebrew/opt/openssl@1.1/lib" export CPPFLAGS="-I/opt/homebrew/opt/openssl@1.1/include" -
Install a lib:
pip install psycopg2-binary