Richard
Richard

Reputation: 167

Switching to postgresql for heroku deployment of rails application

I have a rails application currently using sqlite3. Following this guide: https://devcenter.heroku.com/articles/rails3 I'm trying to switch to postgresql. I changed my gemfile but when I run bundle install I get this error:

Errno::EACCES: Permission denied - /Users/me/.rvm/gems/ruby-1.9.3-p194/gems/pg-0.14.0/.gemtest An error occured while installing pg (0.14.0), and Bundler cannot continue. Make sure that gem install pg -v '0.14.0' succeeds before bundling.

so I try gem install pg -v '0.14.0' and get this error:

ERROR: While executing gem ... (Errno::EACCES) Permission denied - /Users/me/.rvm/gems/ruby-1.9.3-p194/gems/pg-0.14.0/.gemtest

I found a few people with similar problems but I couldn't get it working. This is my first time trying to deploy a rails application so I don't have much intuition about what I'm doing.

Upvotes: 1

Views: 179

Answers (1)

Michael Durrant
Michael Durrant

Reputation: 96454

Are you sure postgres itself is installed / correct? the pg gem is the rails adapter, but you also need postgres itself on the machine.

e.g.

brew install postgresql
initdb /usr/local/var/postgres
mkdir -p ~/Library/LaunchAgents
cp /usr/local/Cellar/postgresql/9.0.4/org.postgresql.postgres.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/org.postgresql.postgres.plist
rails new myapp -D postgresql
...
bundle install (install pg gem)

Upvotes: 1

Related Questions