Search code examples
pg

Failed to install pg 0.18.2 on iOS 10.10.5


I uninstall version 0.18.1 and now I cannot install any of the versions. I would like to install 0.18.2 I am running this command:

gem install pg -v '0.18.2'
Building native extensions.  This could take a while...
ERROR:  Error installing pg:
    ERROR: Failed to build gem native extension.

    /Users/liviu-mac/.rvm/rubies/ruby-2.2.1/bin/ruby -r ./siteconf20150901-1693-1wdi2b8.rb extconf.rb
checking for pg_config... no
No pg_config... trying anyway. If building fails, please try again with
 --with-pg-config=/path/to/pg_config
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.

Don't know how to fix the installation?


Solution

  • I used a wrong path, the correct command in my case is:

    gem install pg -- --with-pg-config=/Applications/Postgres.app/Contents/Versions/9.4/bin/pg_config
    

    I used 9.3 instead of 9.4