I have a Rails app that has been using sqlite3 for the DB. Deployed to Heroku. Then find out that Heroku recommends switching to PostgreSQL. So now I'm trying to switch over without any luck. [Was trying to use this Railscasts video for help](http://railscasts.com/episodes/342-migrating-to-postgresql?view=asciicast).

I installed Homebrew. Installed PostgreSQL via Homebrew. After installation, there was no mention of creating a username or password for postgres.

I edited my Gemfile to 

```
gem 'pg'

```

for both production and development and did `bundle install`.

I edited my `database.yml` file to this:

```
development:
  adapter: postgresql
  database: isement_dev
  encoding: unicode
  pool: 5
  timeout: 5000

test:
  adapter: postgresql
  database: isement_test
  encoding: unicode
  pool: 5
  timeout: 5000

production:
  adapter: postgresql
  database: isement_production
  encoding: unicode
  pool: 5
  timeout: 5000

```

Like Ryan says to do in the video, I try this command:

```
rake db:create:all

```

Only to get this error: 

```
could not connect to server: Permission denied
Is the server running locally and accepting
connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?

```

I do some more searching, and see that some tutorials show username and password included in the `database.yml` file. I then find out how to [setup a user for Postgresql](http://www.postgresql.org/docs/8.1/static/app-createuser.html)

After entering in the command `$ createuser joe`, I was never given the options that the docs say you'll be asked. Such as "Shall the new role be a superuser? (y/n)" So really not sure if the user was created, but there wasn't any errors either.

So, I'm assuming, after creating the user "joe", I reedited my `database.yml` file to include the user field I just created:

```
 development:
   adapter: postgresql
   database: isement_dev
   encoding: unicode
   pool: 5
   timeout: 5000
   username: joe
   password:

 test:
   adapter: postgresql
   database: isement_test
   encoding: unicode
   pool: 5
   timeout: 5000

```

Only to still get the same error of not being able to connect.

I've ran the command

```
 pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start

```

to make sure the server is running as well.

Just in case it's needed, when I run

```
which psql

```

I receive this: 

```
 /usr/local/bin/psql

```

Is there something that I'm missing? The "database name" part of the `database.yml file`. This is supposed to be a database already created somewhere, or does this file create the database when I run the `rake db:create:all` command? I'm assuming the latter, so the name of the database doesn't matter?