Monday, June 20, 2011

Installing pg gem without having Postgres installed

If you get this error:


ubuntu@ip-10-204-65-124:~$ sudo gem install pg
Building native extensions.  This could take a while...
ERROR:  Error installing pg:
ERROR: Failed to build gem native extension.


        /usr/local/bin/ruby 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 ***

Try:

sudo apt-get install libpq-dev 

Then try again: 

sudo gem install pg