I have been trying to install pg to run my web application (Ruby on Rails).

I use a pg database.

With bundle install, it fails.

The output is:

current directory: /home/pi/.rvm/gems/ruby-2.3.3/gems/pg-0.18.4/ext
/home/pi/.rvm/rubies/ruby-2.3.3/bin/ruby -r
./siteconf20161225-10359-1iu9cfy.rb extconf.rb
checking for pg_config... no
No pg_config... trying anyway. If building fails, please try again with
checking for libpq-fe.h... no
Can't find the 'libpq-fe.h header
*** 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 mayneed configuration options.


An error occurred while installing pg (0.18.4), and Bundler cannot
Make sure that `gem install pg -v '0.18.4'` succeeds before bundling.

What is the way to fix it?

  • Where is pg_config on your system? Try to find it with locate pg_config or with find / -name '*pg_config*' – janos Dec 25 '16 at 18:34
  • have you run gem install pg -v '0.18.5 successfullly? – Steve Robillard Dec 25 '16 at 19:04

I expect installing the PostgreSQL libraries is a requirement:

sudo apt-get install libpq-dev

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.