I created a new rails app: rails new -d postgresql
However, I cannot get the pg gem to install. I had previously installed postgres using brew and it starts up automatically with my Mac.
I have tried several things posted here on SO. I am using ruby 2.0. When running bundle install, I get the error:
Errno::EACCES: Permission denied - /Library/Ruby/Gems/2.0.0/gems/pg-0.17.1/.gemtest
An error occurred while installing pg (0.17.1), and Bundler cannot continue.
Make sure that
gem install pg -v '0.17.1'
succeeds before bundling.
I tried downloading the postgresapp, but when I try to start it, there is an obvious conflict b/c it says: could not start on Port 5432. Not sure if this is causing an issue or not.
I also tried this:
sudo env ARCHFLAGS="-arch x86_64" gem install pg -- --with-pg-
config=/Users/david/Library/Application Support/Postgres/var-9.3/postgresql.conf
And got the error: Failed to build gem native extension.
I am a fairly new programmer, so please be as detailed as possible in your response. Thanks!
FIXED: I followed Justin's advice below and then did a restart. After that, I reran 'bundle install' and the pg gem finally installed!