Postgres DB not starting on Mac OSX: ERROR says: connections on Unix domain socket [closed]
Solution 1:
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.
Solution 2:
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
Solution 3:
I have the database working now.
Here are the steps I took:
- I rebooted my computer
- I opened the terminal and ran
cd /
- Then I did
ls -la
- Ensured that I could get to
MackintoshHD/usr/local/var/postgres
- Then did
ls -la
- Here I saw the postmaster.pid file
- I ran this command
cp postmaster.pid ~/Desktop
which copied the file to my desktop.I like to do this if I am deleting files. If something does wrong i can put it back - Then I ran this command to remove the file from the postgres
directory
rm -r postmaster.pid
- I went to my pgadmin3 gui and fired it up. and Voila it worked :)
Thanks to @Craig Ringer for his help
Solution 4:
I'm using Postgres.app, and the below worked for me:
I entered the commands into my terminal below, locating the Postgres folder beforehand and not using "justin".
$declare -x PGDATA="/Users/justin/Library/Application Support/Postgres/var-9.4"
$pg_ctl restart -m immediate
As Justin explains in his post, the output after this was:
waiting for server to shut down……………………………………………………… failed pg_ctl: server does not shut down
After entering the command again:
$pg_ctl restart -m immediate
It worked and I got this message:
pg_ctl: old server process (PID: 373) seems to be gone starting server anyway server starting LOG: database system was interrupted; last known up at 2015-07-28 18:15:26 PDT LOG: database system was not properly shut down; automatic recovery in progress LOG: record with zero length at 0/4F0F7A8 LOG: redo is not required LOG: database system is ready to accept connections LOG: autovacuum launcher started
Source