by
back

install gem pg on yosemite with postgresapp installed

If you have trouble to install the postgres-gem on your mac (yosemite or any later mac os-x version) with postgresapp installed, you probably get an error message like this:

ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
[...]
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.

Solution:

1) set the pg-path like this
Add the following line to your ~/.bash_profile

export PATH=$PATH:/Applications/Postgres.app/Contents/Versions/9.4/bin

source: http://postgresapp.com/documentation/cli-tools.html

2) install pg-gem manually

sudo ARCHFLAGS="-arch x86_64" gem install pg -v '0.17.1'


comments powered by Disqus