rogulski.it

My name is Piotr, a passionate pythonista and this is my blog!

Install psycopg2-binary on Apple M1 silicon

Posted at — May 1, 2022
  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