user1713964
user1713964

Reputation: 1249

sudo: unknown user: postgres

I'm currently trying to run postgresql (9.3) on my iMac but I have some issues with user postgres and psql connection.

I bought an iMac old generation (with snow Leopard) that was migrated to Lion. As followed on other StackOverflow topics I added this line on my .bash_profile :

export PATH=/Library/PostgreSQL/9.3/bin:/usr/bin:$PATH

When launching pg :

sudo su postgres -c '/Library/PostgreSQL/9.3/bin/pg_ctl -D /Library/PostgreSQL/9.3/data/ -m fast start'

it returns :

su: unknown login: postgres

What should I do ?

Upvotes: 20

Views: 35222

Answers (3)

avjaarsveld
avjaarsveld

Reputation: 599

I got this same error (su: unknown login: postgres) when trying sudo su - postgres. I then managed to log in using sudo psql -U my.username postgres.

I could then create the appropriate users, etc.

Hope that helps.

Upvotes: 23

chancyWu
chancyWu

Reputation: 14403

The default postgres user in OSX 10.8 & 10.9 should be _postgres, you can use sudo -u _postgres to run the command

Upvotes: 34

Valery Viktorovsky
Valery Viktorovsky

Reputation: 6726

Try to start from current user:

/Library/PostgreSQL/9.3/bin/pg_ctl -D /Library/PostgreSQL/9.3/data/ -l /usr/local/var/postgres/server.log start

Additional info: How to start PostgreSQL server on Mac OS X?

Upvotes: 0

Related Questions