FATAL ERROR lock file “postmaster.pid” already exists

Posting this in case it helps someone else:

I was having this same problem as the OP after a hard reboot when my laptop crashed. What helped me was running the following command to see what PID was associated with postmaster.pid:

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

The first number that appears will be the PID. Looking in Activity Monitor, I was able to see that Postgres was running, but without a PID number that matched the one shown.

Instead of the steps outlined in the answer referenced on Superuser, I restarted my laptop properly and then opened up Terminal and ran

brew services restart postgresql

This worked without having to remove postmaster.pid, which I saw a few other posts recommend. Sometimes it’s the simple solutions that work.

Leave a Comment