is the server running locally and accepting connections on unix domain socket /tmp/.s.pgsql.5432 code example
Example 1: postgresql blocked on mac
$ brew services stop postgresql
$ rm /usr/local/var/postgres/postmaster.pid # adjust path accordingly to your install
$ brew services start postgresql
Example 2: 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"?
$ rm /usr/local/var/postgres/postmaster.pid
$ brew services restart postgresql
# Think to restart your terminal (cmd + q on macOS)