I appreciate the other 2 answers from @Vishnudev and @cetver
But I tried to install postgresql using brew install and it took a very long time and I still cannot complete after 20 mins.
I figured this out eventually after much googling
Here are my tech specs of my situation:
- monterey 12.1.0
- Apple silicon
- zsh
Concepts
Conceptually, what I did is :
- install openssl, turn on all the exports associated with that,
- then install libpq, turn on all the exports associated with that,
- then turn on python venv
Here are my steps I took. It's entirely possible not all steps are needed. But I have limited time so here they are.
Steps
brew install openssl
- put the following in .zshrc
export PATH="/opt/homebrew/opt/openssl@1.1/bin:$PATH"
- put the following in .zshenv
export LDFLAGS="-L/opt/homebrew/opt/openssl@1.1/lib"
export CPPFLAGS="-I/opt/homebrew/opt/openssl@3/include"
export PKG_CONFIG_PATH="/opt/homebrew/opt/openssl@1.1/lib/pkgconfig"
source ~/.zshrc
brew install libpq
- put the following in .zshrc
export PATH="/opt/homebrew/opt/libpq/bin:$PATH"
- put the following in .zshenv
export LDFLAGS="-L/opt/homebrew/opt/libpq/lib"
export CPPFLAGS="-I/opt/homebrew/opt/libpq/include"
export PKG_CONFIG_PATH="/opt/homebrew/opt/libpq/lib/pkgconfig"
source ~/.zshenv
- Turn on venv
- Now the installing of psycopg2-binary should work
Links that help me:
- the one abt openssl
- the one abt libpq