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