Last Updated: 2023-12-03
psql after a bad shutdown gives the following error:
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"?
Often the problem is a
.pid file hanging around. This can be resolved as
The workflow begins by inspecting logs. On Mac
~/Library/Logs contains logs
for applications I set up.
Entries related to postgres can be found with:
$ find . -name *postgres*
In my case, this shows a ton of files indicative of crashes:
./DiagnosticReports/postgres_2019-08-20-195715_Jacks-MacBook-Pro.crash ./DiagnosticReports/postgres_2019-08-20-200706_Jacks-MacBook-Pro.crash ./DiagnosticReports/postgres_2019-08-20-205835_Jacks-MacBook-Pro.crash ./DiagnosticReports/postgres_2019-08-21-125702_Jacks-MacBook-Pro.crash ...
Let's view the most recent one:
find . -name *postgres* | sort | tail -1 | xargs cat
Bingo, here's the problem - a dependency went missing (probably due to some
Termination Reason: DYLD, [0x1] Library missing Application Specific Information: dyld: launch, loading dependent libraries Dyld Error Message: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.63.dylib Referenced from: /usr/local/opt/postgresql/bin/postgres Reason: image not found