How can this be? Up util now it hase been working fine.

$ brew services start postgresql
Service `postgresql` already started, use `brew services restart postgresql` to restart.

$ psql
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"?

How to fix that?

   Version psql (PostgreSQL) 11.1
  • How have you configured the database server? – Kusalananda Feb 7 at 11:54

Is there's a chance You've had PostgreSQL already installed before and a newer version appeared in brew so postgresql was upgraded to newer version?

If this is Your case Your datafiles are not compatible with newer version of postgresql and database upgrade is necessary. It should be safe to run it even if it's not needed.

PostgreSQL post install message:

==> Caveats
To migrate existing data from a previous major version of PostgreSQL run:
  brew postgresql-upgrade-database

To have launchd start postgresql now and restart at login:
  brew services start postgresql
Or, if you don't want/need a background service you can just run:
  pg_ctl -D /usr/local/var/postgres start```

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.