Is the server running locally and accepting connections on unix domain socket "/tmp/.s.pgsql.5432"?

1.4K    Asked by BuffyHeaton in SQL Server , Asked on Feb 7, 2023

The error in its entirety reads:

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


This is my second time setting up Postgresql via Homebrew on my Mac, and I have no clue what is going on. Previously, it had been working. At some point, I must've entered a command that messed things up. I'm not sure. Now, whenever I enter a SQL command from the command line, I receive the above message. I've run a command to check whether the server is running, and it apparently is not. If I attempt to start the server using

$ postgres -D /usr/local/pgsql/data
I receive the following error:

postgres cannot access the server configuration file "/usr/local/pgsql/data/postgresql.conf": No such file or directory


I've uninstalled and reinstalled Postgresql via Homebrew, but the problem persists. I'm completely at a loss as to how to get this working. Any help would be appreciated.

Answered by Claudine Tippins

The answer to your question - is the server running locally and accepting connections on unix domain socket "/tmp/.s.pgsql.5432"? is: 

For pure installing postgresql on Mac OS, the process will be (using brew command):

brew install postgresql
then if you want to automatically run postgresql at login:
ln -sfv /usr/local/opt/postgresql/*.plist ~/Library/LaunchAgents
or else you just want to run it anytime you want:
postgres -D /usr/local/var/postgres

If your case is more complicated, let's uninstall postgresql and redo these steps.



Your Answer

Interviews

Parent Categories