I'm new to unix and having trouble running initdb with postgresql. I installed postgres via homebrew with "brew install postgres", and have attempted to run the initdb command as follows:

initdb /usr/local/var/postgres The files belonging to this database system will be owned by user "philhowie". This user must also own the server process.

The database cluster will be initialized with locale en_NZ.UTF-8. The default database encoding has accordingly been set to UTF8. The default text search configuration will be set to "english".

creating directory /usr/local/var/postgres ... initdb: could not create directory "/usr/local/var/postgres": Permission denied

Is postgresql supposed to run as a different user account? In that case, how do I set that up? I can't run this command as root it seems.

Thanks for your help!

1 Answer 1


Homebrew deliberately doesn't do any setup for you, allowing you to do it all yourself. Systems like MacPorts are more focused on that value-add.

So, in this case start with http://www.postgresql.org/docs/9.1/interactive/runtime.html and follow their guidance on doing all the setup work by hand - homebrew built from source for you, but the rest is up to you.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .