I'm trying to bundle a new rails app using Postgres.
I get this error each time I try to bundle.
Errno::EACCES: Permission denied - /usr/local/var/rbenv/versions/2.0.0- p353/lib/ruby/gems/2.0.0/gems/pg-0.17.0/.gemtest
An error occurred while installing pg (0.17.0), and Bundler cannot continue.
Make sure that `gem install pg -v '0.17.0'` succeeds before bundling.
When I try to install the pg gem with sudo it says:
➜ wandrr sudo gem install pg -v '0.17.0'
Password:
Building native extensions. This could take a while...
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
/usr/local/var/rbenv/versions/2.0.0-p353/bin/ruby extconf.rb
checking for pg_config... no
No pg_config... trying anyway. If building fails, please try again with
--with-pg-config=/path/to/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.
I've read pg app's documentation and still not sure.
My zshrc file looks like this
# Customize to your needs...
PATH="/Applications/Postgres.app/Contents/MacOS/bin:$PATH"
export RBENV_ROOT=/usr/local/var/rbenv
if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi
I used homebrew to install rbenv and ruby-build.
I've check ruby gems is up to date aswel.
Any suggestions on how to get the pg gem to succeed?
SOLUTION FOUND
My initial problem of trying to get gem install pg
to work was due to the postgres app not working right. The problem was fixed by checking the path set in my ZSHRC file.
Here's what it looks like now:
# Customize to your needs...
PATH=/Applications/Postgres93.app/Contents/MacOS/bin:$PATH
eval "$(rbenv init -)";
Note: the docs said to use
PATH="/Applications/Postgres.app/Contents/MacOS/bin:$PATH"
however the application in this instance is called Postgres93.app