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.
It's very simple. Only add host in your database.yaml file.
This worked for me for the error you mentioned. Do one of these:
Possibly change your default port specified in the postgres.conf
file,
if you have used something other than the default port 5432
while installing.
Change the port number in postgresql.conf
and restart the DB server.
Instead of psql
type the full command:
psql -p 5432 -h localhost
"Postgres.app" is a better fix if you are on OS X
Here is the fix:
cd /var
sudo rm -r pgsql_socket
sudo ln -s /tmp pgsql_socket
chown _postgres:_postgres pgsql_socket
More information is available at "postgresql 9.0.3. on Lion Dev Preview 1".
I fixed this by upgrading postgres.
brew update
brew upgrade
Then I had to also upgrade the databases to be compatible with the new major version, because I upgraded from 10 to 11.
brew postgresql-upgrade-database
(source https://github.com/facebook/react-native/issues/18760#issuecomment-410533581)