I believe the “correct” answer would be to first configure PATH correctly for Postgres.app by adding the following to ~/.profile
(.zshrc
or ~/.zprofile
if using ZSH):
export PATH=$PATH:/Applications/Postgres.app/Contents/Versions/latest/bin
Then open a new tab or window in terminal and install the pg
gem with:
ARCHFLAGS="-arch x86_64" gem install pg
Documented here: