- Remove the old postmaster.pid file:
trash /usr/local/var/postgres/postmaster.pid
# or rm /usr/local/var/postgres/postmaster.pid
- Restart the postgresql service:
brew services restart postgresql
To use the trash
command, install the Trash CLI by Sindre Sorhus.
I found the answer on Stack Overflow: Cannot connect to Postgres server running through brew services