Postgres DB not starting on Mac OSX: ERROR says: connections on Unix domain socket [closed] Postgres DB not starting on Mac OSX: ERROR says: connections on Unix domain socket [closed] unix unix

Postgres DB not starting on Mac OSX: ERROR says: connections on Unix domain socket [closed]


I had the same problem today on Mac Sierra. In Mac Sierra you can find postmaster.pid inside /Users/<user_name>/Library/Application Support/Postgres/var-9.6. Delete postmaster.pid and problem will be fixed.


This can happen if the database did not shut down correctly. To fix it simply delete the postmaster.pid file. The location differs based on your OS:

MacOS:

 rm /Users/<user_name>/Library/Application\ Support/Postgres/var-9.6/postmaster.pid

or using Postgres.app:

 rm /Users/<user>/Library/Application\ Support/Postgres/var-10/postmaster.pid

Linux:

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


I have the database working now.

Here are the steps I took:

  1. I rebooted my computer
  2. I opened the terminal and ran cd /
  3. Then I did ls -la
  4. Ensured that I could get to MackintoshHD/usr/local/var/postgres
  5. Then did ls -la
  6. Here I saw the postmaster.pid file
  7. I ran this command cp postmaster.pid ~/Desktop which copied thefile to my desktop.I like to do this if I am deleting files. Ifsomething does wrong i can put it back
  8. Then I ran this command to remove the file from the postgresdirectory rm -r postmaster.pid
  9. I went to my pgadmin3 gui and fired it up. and Voila it worked :)

Thanks to @Craig Ringer for his help