Topic: pg gem [SOLVED]

I have beed trying to get the PG gem install and this is what i get


sudo gem install pg --include-dependencies
Password:
INFO:  `gem install -y` is now default and will be removed
INFO:  use --ignore-dependencies to install only the gems you list
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... yes
Using config values from //usr/bin/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.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
    --with-opt-dir
    --without-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/usr/local/bin/ruby
    --with-pg
    --without-pg
    --with-pg-dir
    --without-pg-dir
    --with-pg-include
    --without-pg-include=${pg-dir}/include
    --with-pg-lib
    --without-pg-lib=${pg-dir}/lib
    --with-pg-config
    --without-pg-config
    --with-pg_config
    --without-pg_config


Gem files will remain installed in /usr/local/lib/ruby/gems/1.8/gems/pg-0.13.2 for inspection.
Results logged to /usr/local/lib/ruby/gems/1.8/gems/pg-0.13.2/ext/gem_make.out

Last edited by moiseszaragoza (2012-05-21 14:27:42)

Re: pg gem [SOLVED]

NEVER install gems as sudo, your ruby intallation and your rails app should ALWAYS have access to them,

To manage your ruby versions and your gems Install and use rvm (http://beginrescueend.com/rvm/install/) or RBEnv (https://github.com/sstephenson/rbenv/wiki) then simply add 'gem pg' to your Gemfile under whatever section you want and run bundle install on the command line

What you want and what you need are too often not the same thing!
When your head is hurting from trying to solve a problem, stop standing on it. When you are the right way up you will see the problem differently and you just might find the solution.
(Quote by me 15th July 2009)