Fix the "/tmp/.s.PGSQL.5432" Postgres
Not solved Solved
almost 2 years ago

Whenever my Macbook runs out of battery, my Postgresql database is stuck in a weird state and I get this message when launching rails s:

psql: could not connect to server: No such file or directory
    Is the server running locally and accepting
    connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
almost 2 years ago

Very simple, just run this in your terminal. You should be good to go!

rm /usr/local/var/postgres/
almost 2 years ago

My associate always has that but when I run this command I get no such file or directory :/

over 1 year ago

kind of running into this issue as well.

similar to this:

tried initdb with $ sudo , $ -su $ sudo -u username but always get

initdb: could not change permissions of directory "/usr/local/var/postgres": Operation not permitted

Any idea? Thanks!

over 1 year ago

I bet you upgraded to El Capitan. Then your Homebrew permissinons have been screwed up. You should run this:

sudo chown -R `whoami` /usr/local 
over 1 year ago

indeed! Thanks

9 months ago

Après la mis à jour mac os sierra, j'ai du faire cela :

OS X/Homebrew:

Try running postgres -D /usr/local/var/postgres -- it will give you a much more verbose output if postgres fails to start.

In my case, running rm -rf /usr/local/var/postgres && initdb /usr/local/var/postgres -E utf8 removed my old databases and then reinitialized the postgres db schema.

source :

Submit your answer