← All writing

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.

  1. Update xcode:

    xcode-select --install
  2. Install homebrew:

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

    brew install postgresql
  4. Install openssl:

    brew install openssl
  5. Link openssl:

    brew link openssl
  6. 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"
  7. Install a lib:

    pip install psycopg2-binary
← More writing