Fixing Postgres connection issue on Mac with Rails

When doing using rails on Mac which require Postgres, an error appeared which showing connection problem.

could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket “/var/pgsql_socket/.s.PGSQL.5432”?

to fix this just add“export PGHOST=localhost” to your bashrc or zshrc

Advertisements