PostgreSQL: Troubleshooting PostgreSQL

Join the AI Workshop to learn more about AI and how it can be applied to web development. Next cohort February 1st, 2026

The AI-first Web Development BOOTCAMP cohort starts February 24th, 2026. 10 weeks of intensive training and hands-on projects.


Fix the “could not connect to server” error

If you installed PostgreSQL in the past using Homebrew, then updated its version with brew upgrade, you might not be able to start it again.

Whenever you try to access it, you get this error:

psql: error: 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"?

The server might be running fine (you can check with ps aux | grep postgres), but connections fail.

The simplest solution is to reinstall PostgreSQL:

brew uninstall postgresql
brew install postgresql
brew services start postgresql

After this, you should be able to connect to the database again.

Lessons in this unit:

0: Introduction
1: Introduction to PostgreSQL
2: How to install PostgreSQL on macOS
3: How to create a PostgreSQL database
4: Navigating Databases in PostgreSQL
5: PostgreSQL User Permissions
6: Tables and Data Types
7: Where to host a PostgreSQL database
8: PostgreSQL vs MySQL
9: ▶︎ Troubleshooting PostgreSQL
10: Vercel Postgres, no transactions?
11: Set up Lucia Auth for local Postgres DB vs Vercel Postgres
12: Connect to Postgres local vs Vercel Postgres with Kysely