Like some others I am getting this error when I run rake db:migrate in my project or even try most database tasks for my Ruby on Rails 3.2 applications.
If you're on MacOS and using homebrew I found this answer extremely helpful:
https://stackoverflow.com/a/27708774/4062901
For me, my server was running but because of an upgrade I was having issues connecting (note: I use brew services). If Postgres is running, try cat /usr/local/var/postgres/server.log and see what the logs say. My error was a migration, not a connection issue.
Also after the manual migration they propose (which does work but) I found there was no longer a table for my user. Try this command to fix that: createdb (answered via psql: FATAL: database "