I am using the Ruby on Rails 3.1 pre version. I like to use PostgreSQL, but the problem is installing the pg
gem. It gives me the following error:
The location of libpq-fe.h
depends on where your PostgreSQL install is (which depends on how you installed it). Use locate
(http://en.wikipedia.org/wiki/Locate_%28Unix%29) to find the libpq-fe.h
file on your machine. If it exists, it will be in the include
directory of your PostgreSQL install.
$ locate libpq-fe.h
/Library/PostgreSQL/9.1/include/libpq-fe.h
The bin
directory, which contains pg_config
, will be in the same directory as the include
directory. As the error suggests, use the --with-pg-config option to install the gem:
$ gem install pg --with-pg-config="/Library/PostgreSQL/9.1/bin/pg_config"
Note that you may need to run updatedb
if you have never used locate
or if you haven't updated since installing PostgreSQL.