Switch to postgres user on Mac

I would like sufor a postgres user on a Mac so that I can run postgres.

What am I doing wrong here?

delirium:~ anna$ sudo su postgres
delirium:~ anna$

Nothing happens. If I try to start postgres, I will get something like this:

delirium:~ anna$ sudo pg_ctl -D /usr/local/var/postgres -l      
/usr/local/var/postgres/server.log startpg_ctl: cannot be run as root
Please log in (using, e.g., "su") as the (unprivileged) user that will
own the server process.

If I try to do this so suthat I also get an error message:

delirium:~ anna$ sudo su - postgres
su: no directory
delirium:~ anna$

What can I do instead? I am sure that postgres user exists.

+3
source share
2 answers

It looks like the postgres user does not have a login shell. Trysudo -u postgres bash

+11
source

PostgreSQL is integrated into Server.app, available through the App Store in Mountain Lion.

You will have this file: /Library/Server/PostgreSQL/Config/org.postgresql.postgres.plist

You can sudo:

sudo -u _postgres psql template1

Or connect:

psql -h localhost -U _postgres postgres
0
source

All Articles