I use brew's postgresql service and after cold reboot on the mac I was using, I got the following when I tried to access psql on the command line:
psql: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
I got my fix from here. In a nutshell, the postmaster.pid
file already exists and has to be removed. Removing file that file fixed it for me i.e.
rm -f /usr/local/var/postgres/postmaster.pid
You might also want to to checkout the postgres log file (tail -n 10 /usr/local/var/log/postgres.log
) for any errors and bugs.
Homebrew version: 1.7.2 Homebrew/homebrew-core (git revision c4e37; last commit 2018-08-27) psql/postgresql version: 10.5