Applications and operations
Fix a PostgreSQL connection failure
Diagnose service, socket, network, authentication, and database errors without reinstalling PostgreSQL or risking the data directory.
8 minute lesson
Start with the complete error. Do not reinstall PostgreSQL: that can hide the cause and put the existing cluster at risk.
Check the client and Homebrew service:
psql --version
brew services list
Then try an explicit local connection:
psql -h localhost -p 5432 -U notes_app -d notes_app
A missing socket points to service or socket-directory configuration. “Connection refused” points to the server, address, port, or firewall. A FATAL authentication message means the server answered, so check the role, password, pg_hba.conf, TLS, and database name.
Inspect Homebrew service logs before changing configuration. Change one layer at a time and retry the same command.
Lesson completed