Postgresql – Cannot log in with default user on Mac 10.10

loginsmac os xpostgresqlpostgresql-9.3

I am running PostgreSQL on a Mac 10.10

PostgreSQL 9.3.5 on x86_64-apple-darwin12.5.0, compiled by Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn), 64-bit

I am having trouble connecting to the _postgres Mac account. As far as I remember, the under Mac created account is not postgres but _postgres. I want to log in as that account to access Postgres and create a new role/database for some user on the system.

sudo -u _postgres psql

Throws me this:

psql: FATAL: role "_postgres" does not exist

While:

sudo -u postgres psql 

gives me this:

sudo: unknown user: postgres

So, how to login as the default Postgres user?!

Best Answer

Just try your normal user account. bash# psql postgres. Depending on how you installed PostgreSQL (homebrew, ports or Postgres.app) the default account is set to your account instead of a seperate one. Beside this, consider to update to 9.3.11