rwgkzw
Last Updated: January 04, 2018
·
26.3K
· miguelperez
De8b71442a3187222718bd993f1eb835

WTF, Is the server running locally and accepting connections on Unix domain socket "/tmp/.s.PGSQL.5432"?

Lately, I had this problem. Pretty annoying btw.

I was browsing internet and had several chrome tabs opened... Suddenly my mac crashed and frozen... I wait, but nothing happened, so I hard turned it off. The next day none of my rails applications were working.

I have postgres installed with brew. Started googling, and found this SO answer...

http://stackoverflow.com/questions/13573204/psql-could-not-connect-to-server-no-such-file-or-directory-mac-os-x

It basically says to remove the file

/usr/local/var/postgres/postmaster.pid

Basically since I shut my laptop down, postgres was not able of removing that file... on the next run postgres could not run.

Say Thanks
Respond

8 Responses
Add your response

11841
1c6b43cf910e569d0594addbb5c0785a

Removing that file worked for me. Thank you!

over 1 year ago ·
13451
E6553dd6159aa8de9399bfb35ca88a77

Thank you, that worked

over 1 year ago ·
14206
505427

Thanks, worked here :)

over 1 year ago ·
14722
De8b71442a3187222718bd993f1eb835

Im glad it is working for everyone! :D

over 1 year ago ·
20796
A7ca236994740857cccbacbf7c0531b1

Same here, thank you

over 1 year ago ·
28607

Hello. I am having the same problem and it's driving me crazy. I searched in the folder /usr/local/var/postgres/postmaster and I don't have a postmaster.pid file. Any suggestions on what else I could try?

over 1 year ago ·
29124

If you ran into this after upgrading with homebrew, you may need to follow the instructions here (instead of messing around with the postmaster.pid file): https://collectiveidea.com/blog/archives/2016/01/08/postgresql95-upgrade-with-homebrew
Those were written for version 9.5, but they worked perfectly for version 9.6.3 for me today.

7 months ago ·
29546

This happens when postgres server is not running.
Steps to properly install Postgres via Homebrew on MAC :

  1. brew install postgres

  2. initdb /Users/<username>/db -E utf8
    [This initializes postgres to use the given directory as the database directory. Normally it is not adviced to use the user directory for database storage. Edit sudoers file to add initdb and similar commands and then run initdb on /usr/local/var/postgres]

  3. pg_ctl -D /Users/<username>/db -l logfile start
    [After getting success with step 2 it will prompt to run step 3. This command manually starts the server.]

about 1 month ago ·