Skip to content

Instantly share code, notes, and snippets.

@iandouglas
Last active November 28, 2020 23:41
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iandouglas/44db421fe2ad9dc852e3ed65b40506b9 to your computer and use it in GitHub Desktop.
Save iandouglas/44db421fe2ad9dc852e3ed65b40506b9 to your computer and use it in GitHub Desktop.
Debugging PostgreSQL problems

I got 99 problems and PostgreSQL is EVERY SINGLE ONE OF THEM!

I put together these notes to help diagnose and repair PostgreSQL installations and other problems.

Step One -- how did you install the app?

You either installed it via Homebrew, or you installed it via download at postgresapp.com. Either is fine. Most problems I see with PostgreSQL come from Homebrew.

If you installed BOTH you need to decide which one to remove.

Step Two -- what's the error message you're seeing?

running psql keeps prompting me for a password

Homebrew handles this for you, so that points me to running the postgressapp.com version. If you DO use Homebrew, stop here and contact me to help diagnose.

For postgresapp.com folks, try the following command, substituting YOURUSERNAME for whatever your laptop username is (run whoami at a terminal prompt if you're unsure):

$ /usr/local/opt/postgres/bin/createuser -s YOURUSERNAME

This should make you a "superuser" with the ability to create/drop entire databases and so on.

something about /tmp/.s.PGSQL.5432

Vimeo walkthrough - 10 minutes

Try this:

$ ps aux | grep post

This command will look at all processes running and filter only things containing the word "post". If the only line of output shows the "grep post" then PostgreSQL is definitely NOT running.

$ sudo rm /usr/local/var/postgres/postmaster.pid

Then try starting PostgreSQL again (brew servies start postgresql)

Then try the ps aux | grep post command above to see if there are more PostgreSQL processes running. If so, you should be all set.

something is already running on port 5432

You probably have both Homebrew AND the postgressapp.com versions installed, and you need to remove one and keep the other.

something else?

Send me a DM on Slack, we'll get on a Zoom call where we record the call and I'll help you diagnose it, and then I'll update this document and link your video.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment