psql does not require a password on macOS with Postgres.app When opening the psql console, there is no password prompt. This behaviour is the same for all postgres users. I can basically do everything without a password. This seems rather unsafe.

How do I enable password checking? I'm running macOS Mojave and use Postgres.app with postgresql version 10.

This is the command I use:

psql -Umyuser # this user has a password set
Found the answer in another post on stackexchange.

I've edited the authentication lines in pg_hba.conf and changed "trust" into "password" for all lines. It now looks like this:

# TYPE  DATABASE        USER            ADDRESS                 METHOD

local   all             all                                     password
host    all             all             127.0.0.1/32            password
host    all             all             ::1/128                 password
local   replication     all                                     password
host    replication     all             127.0.0.1/32            password
host    replication     all             ::1/128                 password


Now psql asks me for a password every time.