I was installing postgres on macos sonoma (apple M1 chip) and after installing, then starting the service and finally running psql in the terminal I ran into this error
psql: error: connection to server on socket "/tmp/.s.PGSQL.5432" failed: No such file or directory
Is the server running locally and accepting connections on that socket?
Steps taken to arrive at this error:
$ brew install postgresql
$ brew services start postgresql
When I run $ brew services list
there's this error
Didn't find a specific answer but I resolved the error as below (in the answer)
To install postgresql:
$ brew install postgresql
this installs the latest stable version of postgresql available$ initdb /opt/homebrew/var/postgresql@14
$ brew services start postgresql
Running $ brew services list
should show a successful running instance (shown in screenshot below)
TIP: To see the errors logged when running the service you can open the logs stored in [email protected]
$ vi /opt/homebrew/var/log/[email protected]
(That's how I found the specific error I was seeing when listing the service and a potential solution)