Crashes
My new Apple M1 has sometimes restarted itself. As a result I have run into situations where I’m getting errors that I cannot connect to my Postgres on my laptop.
$ psql
psql: could not connect to server: No such file or directory
Is the server running locally and accepting connections
...
If you used homebrew
to install postgres you could try the following command to restart the server, but it might not work.
brew services restart postgresql
If you still cannot connect then you need to delete the PID.
Delete the PID
If you are using homebrew it looks like they have moved this in a different place on Apple M1 computers. Here is my path and the command I use in order to do so.
rm /opt/homebrew/var/postgres postmaster.pid
Then restart the service
brew services restart postgresql
Finished.