postgres.app: How Do I Install libpq-dev on the Mac?

1.6k views Asked by At

I'm running the latest version of postgres using the postgres app.

[mydir] (master) which psql
/Applications/Postgres.app/Contents/Versions/latest/bin/psql

I've been getting errors when I try to install the RubyGem pg.

ERROR:  Error installing pg:
    ERROR: Failed to build gem native extension.

    current directory: /Users/myusername/.rvm/rubies/ruby-3.0.0/lib/ruby/gems/3.0.0/gems/pg-0.21.0/ext
/Users/myusername/.rvm/rubies/ruby-3.0.0/bin/ruby -I /Users/myusername/.rvm/rubies/ruby-3.0.0/lib/ruby/site_ruby/3.0.0 -r ./siteconf20210521-34776-tmn3lu.rb extconf.rb --with-pg-config\=/Applications/Postgres.app/Contents/Versions/latest/bin/pg_config
Using config values from /Applications/Postgres.app/Contents/Versions/latest/bin/pg_config
checking for libpq-fe.h... yes
checking for libpq/libpq-fs.h... yes
checking for pg_config_manual.h... yes
checking for PQconnectdb() in -lpq... no
checking for PQconnectdb() in -llibpq... no
checking for PQconnectdb() in -lms/libpq... no
Can't find the PostgreSQL client library (libpq)
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.
....... other stuff here ........

From checking many posts about this error over the past few years, a good number of older posts stated that they were able to fix these types of errors by installing libpq-dev.

I have seen this command as a way to install it but apt is unavailable on the Mac.

sudo apt-get install libpq-dev

I've seen other solutions using Homebrew. I don't believe is an option as I have read this will install its version of postgres which I don't want.

I'm using pgAdmin 5.3.

How do I install libpq-dev in my postgres.app database? I was not successful in finding anything online or in the postgres.app documentation.

0

There are 0 answers