miloot.com blog

site news and other musings.

Install PG Gem With Postgres.app on Mac OSX

| Comments

Recently when updating a Gemfile I came across the following error:

1
Can't find the 'libpq-fe.h header

It appears that since I am using Postgres.app instead of a more direct installation ( ala brew install pg ) some of the headers are undefined and not accessible by the gem install command.

To get around this problem I came across the following post from Programming Tidbits

Unfortunately did this not work for me as it appears that with the updated version of Postgres.app the folder structure is a bit off.

I had to modify the commands to the following

1
2
3
export CONFIGURE_ARGS="with-pg-include=/Applications/Postgres.app/Contents/Versions/9.3/include/"

gem install pg

After this everything installed correctly and I was able to resume my work.

Hopefully this helps someone out.

Comments