Download and install http://postgresapp.com/

This will automatically create a postgres user with the name of your machine (i.e. jrasmusson).

Add the ‘pg’ gem to your project.

gem ‘pg’

$ bundle install (or)
$ gem install pg

Remove any old pg gems that might interfere:

$ gem list
$ gem cleanup pg

Check that pg installed correctly and that nothing was already running on port 5432.
$ netstat -anp tcp | grep 5432

Then update your database.yml to use the new username created.

development:
  adapter: postgresql
  host: localhost
  encoding: unicode
  database: nutshell_development
  pool: 5
  username: jrasmusson
  password:

Then configure databases:

$ rake db:create:all

Links that help
http://railscasts.com/episodes/342-migrating-to-postgresql
http://stackoverflow.com/questions/5902488/uninstall-old-ruby-gems-versions
https://www.digitalocean.com/community/articles/how-to-setup-ruby-on-rails-with-postgres

Connecting with pgadmin

pgadmin-connection

Trouble shooting

psql: FATAL: database “user” does not exist
$ createdb

About these ads