Fixing a Stale Postmaster.pid file Error in the Postgres App

Feature thumb stale postmaster pid postgres app

If you're on a Mac and use the Postgres App, you may run into an error that says:

To fix this, follow these steps:

Ensure that no version of Postgres is running. To check, open up the Activity Monitor application and search for postgres and postmaster to ensure neither of them are running. If either of them are running, stop those processes. Assuming that postgres isn't running, delete the file with the following command:
\rm ~/Library/Application\ Support/Postgres/var-11/postmaster.pid

You will need to change the var-11 value to whatever version you're using, you can find this out by running the command:

ls ~/Library/Application\ Support/Postgres/

If you're curious as to why there is a in front of the rm command, that ensures that any aliases that you might have setup don't interfer with the command.

Once that file is removed, you can start Postgres back up.