Fixing Postgres errors after an ungraceful shutdown on your Mac

Every so often, I'm forced to shut down my Mac by holding down the power button. When this happens, PostgreSQL often doesn't shut down properly, and when my computer starts again it doesn't start automatically.

It turns out this is because there's a stale pid file kicking around inside your PostgreSQL var folder. To fix it, simply delete the file. PostgreSQL will start automatically thereafter.

rm /usr/local/var/postgres/
Read on: Things I wish I'd known at 20