This error is quite specific and tells you what is wrong, but if you are new to unix, then this is less obvious.
I gave a similar answer here:
Unable to connect to local PostgreSQL
Problem
You do not have access to the file ("socket") /var/pgsql_socket/.s.PGSQL.5432
To fix it:
Make sure you have access to the directory. At the command line use:
ls -l /var/pgsql_socket/.s.PGSQL.5432
This will result in a “permission denial” if not. You probably already have access to this, and it's just a socket file that you do not have rights to.
The socket file itself is created by postgresql at startup.
Track the main configuration file for postgres ( postgresql.conf ). This in itself can be difficult; I'm a Linux user, not OSX. You may need to spend some time on Google. This link is quite old, but may lead you to the right path if you encounter problems. http://www.postgresqlformac.com/server/howto_edit_postgresql_confi.html
Once you find it, find the lines in postgresql.conf, they should say something like:
unix_socket_directory = '/var/pgsql_socket' # dont worry if yours is different #unix_socket_group = '' # default is fine here unix_socket_permissions = 0777 # check this one
source share