Install and run postgres:
brew install postgresql
initdb /usr/local/var/postgres -E utf8
postgres -D /usr/local/var/postgres
# keep this console open
Show database list:
psql -l # show database list
Add below line to .bashrc to configure default cluster:
export PGDATA=/usr/local/var/postgres
Show user list:
psql -q -c'select * from pg_user' postgres
Create user:
createuser ${user_name_you_want} -P
Enter password for new role: # type password
Enter it again: # again
Create database:
createdb ${database_name_you_want} -O ${user_name_you_want}
psql -l # check that you got a new database
Change privileges:
psql -q -c'select * from pg_user' rails_dev # check privilege
psql ${database_name_you_want} # login
alter role ${user_name_you_want} with superuser;
psql -q -c'select * from pg_user' rails_dev # check privilege again