This is an easy problem that can be fixed if you don't mind install Postgres database using Homebrew.
But my use case, Postgres database is run by docker in the development machine and exposing port into into host. Then I need to install gem pg to development machine which require pg_config. As you may know, this is operation will fail since it's not presented.
This is a bit frustrating since the quick fix is that I just have to install Postgres via Homebrew first then gem install pg to solve this.
But it could be better if postgres isn't required for the installation, since I already have it via docker and install it seems to be a bit of duplication.
What I would like to ask is that do we have an alternatives way for this to work without the need to install postgres ?
I'd searched about libpq, which available in linux but it seems it's not available for macOS.
Got the answer from my colleague. Install libpq then install pg gem with this command
gem install pg -v '0.20.0' -- --with-opt-dir="/usr/local/opt/libpq"
solve the issue
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With