OSX Lion: Postgres could not connect to database postgres (after homebrew installation)


Problem:

createuser: could not connect to database postgres: 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″?

Solution:

I tried many solutions found across the interwebs to no avail. The problem seems quite common, for me the fix was:

Make sure the daemon is indeed running:

ps aux | grep postgres

Find this .s.PGSQL.5432 file:

sudo find / -name .s.PGSQL.5432

Create a Symbolic Link to the destination it’s “supposed to be located at”:

ln -s /private/tmp/.s.PGSQL.5432 /var/pgsql_socket/

Other Possible Solutions

Subscribe

Subscribe to our e-mail newsletter to receive updates.

One Response to “OSX Lion: Postgres could not connect to database postgres (after homebrew installation)”

  1. Brena Monteiro February 12, 2012 at 12:12 pm #

    Hi Iain,

    Your post helped me a lot.

    Thanks ;)

Leave a Reply