1. Home
  2. Ruby
  3. PostgreSQL gem install fails

PostgreSQL gem install fails


Attempting to install the Ruby gem “pg” or other PostgreSQL-dependent gems on v6+ platforms fail with a similar sample response:

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.
Provided configuration options:


PostgreSQL libraries are located in a separate directory, /usr/pgsql-XX, where XX is the version number on these platforms. This path is not picked up in normal configuration.


Install the gem manually while specifying a path to pg_config, which is located in /usr/pgsql-XX/bin. For example, on Sol, which ships with PostgreSQL 9.3, the correct command to install pg is as follows:

gem install pg -v '0.18.3' -- --with-pg-config=/usr/pgsql-9.3/bin/pg_config

Updated on July 8, 2019

Was this article helpful?

Related Articles

Need Support?
Can’t find the answer you’re looking for? Don’t worry we’re here to help! If you get an error, visit https://lithiumhosting.com/support instead.
Contact Support