Psql: error: connection to server on socket "/tmp/.s.PGSQL.5432" failed: No such file or directory

If you’re getting errors like this:

psql: error: connection to server on socket “/tmp/.s.PGSQL.5432” failed: No such file or directory

See post below!

If you’ve tried the usual of:

$ brew services stop postgresql
$ rm /usr/local/var/postgres/postmaster.pid 
$ brew services start postgresql # Or: brew services restart postgresql

…and banged your head a lot, you may find it’s your Mac! Go to:

System Settings > General > Login Items and Extensions > Allow in the Background

To check if you have postgres listed and that it is on!

And if your system is a bit messed up (like mine, thank you Apple!) you may even have TWO!!! BOTH of these must be ON!!

Screenshot 2024-10-17 at 02.57.54

Hope this helps someone! :lol:

1 Like