0
votes

I've tried to install postgres 13.1 on my Mac using homebrew. (Also tried versions 11 & 12 which at one time were installed on this Mac, but encountering same error with those versions now). Am using notes I took from previous installs & of course google/stackoverflow. Tried many things/many times, but always, if I run psql, createuser, createdb (any postgres command), it responds with:

FATAL: role "postgres" does not exist

Also tried just creating a postgres user on my Mac to run install from that account; no luck.

Also tried postgresql install from the enterprisedb.com site. That worked, but seems klunky & seems to rely on .sh scripts. Interestingly, got the 'role postgres does not exist' error after the edb install too, but noticed if I just entered 'postgres' twice on the command line it worked. Example:

/Library/PostgreSQL/13/bin/psql -h localhost -p 5432 -U postgres postgres

This trick doesn't work tho with the brew install.

Understand I need to create the postgres role, but I can't find a command to do this that doesn't complain that the role doesn't already exist.

Any help would be so so appreciated!

link to screenshot

2
which OS user owns the config file, and/or the data files? Try using that name as the existing database role.jjanes

2 Answers

0
votes

Can you try:

/Library/PostgreSQL/13/bin/psql

and then:

CREATE USER postgres SUPERUSER;

?

0
votes

Most sites documenting postgres install with homebrew said to use commands like:

psql postgres or createuser postgres

Those didn't work for me, but this did:

psql -d postgres -U <myUserName>

Attaching a screenshot to try to summarize the install experience & what worked: screenshot