PostgreSQL 9.0.4 on Lion (Clean Install)

The first thing you will unfortunately need to do is purchase and install Lion Server – this currently costs £35 on the app store on top of the £21 for Lion.

After installing, as well as getting /usr/bin/psql as you do with straight Lion, you also get /usr/bin/pg_ctl and /usr/bin/pg_config.

Next you will need to make sure that you are a member of the _postgres group.

$ sudo dscl localhost -append /Local/Default/Groups/_postgres GroupMembership omarqureshi

Once done, you can now run psql – but, only as the _postgres user.

$ psql -U _postgres template1

Finally, to allow access to psql from your own username, you will need to create a role whilst using psql as _postgres

create role omarqureshi superuser login;

After that, you should be able to use createuser and createdb from the shell as normal.