Fixing Postgres startup after Mac OS shuts down unexpectedly

Enkya

Enkya

December 01, 2018

1 min read

Postgres MacOS

Fixing Postgres startup after Mac OS shuts down unexpectedly

I tried starting pgadmin and it failed. When I tried accessing postgres via the terminal, it failed too. With a message:

Error message

As it turns out my mac had shut down unexpectedly. Because Postgres had not shut down correctly, there was still a process running at the default port on which Postgres runs.

To fix this issue, go to your terminal and run Postgres: postgres -D /usr/local/var/postgres

You should be able to see a message like something below

Raincheck Error

The hint should show what process is blocking that port. Run kill -9 PID where PID is the number in the hint.

If there is no error message, you can then try running Postgres again.

Message if error resolved

You should see log information with Postgres’s recovery steps from your last failure. It should also be able to accept your attempts to connect to the server.

Cheers