How to install PostgreSQL's pg gem on Ubuntu?
You need install the postgreSQL dev package with header of PostgreSQL
sudo apt-get install libpq-dev
After reading and thrashing around for 2 days, and trying many things found in other notes the following single line was the cure for me on Ubuntu Lucid 10.04 mixed with some Maverick packages and RVM (ruby 1.9.2-p290, rvm 1.10.2 rubygems 1.8.15, rails 3.0.1, postgres 8.4.10) :
gem install pg -- --with-pg-lib=/usr/lib
the result:
Building native extensions. This could take a while... Successfully installed pg-0.13.1 1 gem installed Installing ri documentation for pg-0.13.1... Installing RDoc documentation for pg-0.13.1...
{yea - finally success} !!!note that the output from running pg_config lacks the item -lpq in the LIBS variable on my Ubuntu / Postresql install!!
and why the switch from pq to pg in certain places -- confusing to newbie ??
the thing I still do not understand is the double set of -- and --with(optionbut I'm way beyond my depth anyway
I'm on Ubuntu 12.10 and running this command:
apt-get install libpq-dev
helped me - after that ran gem install pg -v "0.14.1", and all good now