Postgresql: is there a pre-set database cluster? Do I need initdb?


I’m running a cloned repo that uses rails with postgresql. The repo readme includes postgresql installation instructions, but they’re written for Mac users with Homebrew. I know c9 has postgresql installed (and I found the setup instructions), so I know I’m partly there without any effort.

However, the first post-install instructions in the repo readme call for running initdb /usr/local/var/postgres -E utf8, which can’t be done because initdb isn’t a valid command, and the target directory doesn’t exist. Looking at Homebrew’s postgresql formula, I see that /usr/local/bin/initdb and /usr/local/var/postgres are both added as part of a Homebrew install.

I could add both of those to my workspace, but what I’m wondering is whether I need to. Is there a cluster already? Where is it, and what encoding does it use?


Hey @verythorough :slightly_smiling:,

Going to /usr/lib/postgresql/9.3/bin shows that there is a initdb command there however I can’t get it to run yet either. @bradydowling might know :wink:.
Referenced from:

:book: :snail:


Thanks, @mikeumus, for the initdb location and link. I wound up going a different direction and did eventually initialize the cluster and create/migrate the necessary db. I’m going to go back through the process a few times to find the most efficient and repeatable method so that I can update the installation instructions for the repo I’m working with. When I do that, I’ll post the process here, too.


If you’ve had an insights on this I’d definitely like to hear about it. Also, I didn’t realize until just now that there’s a fork of homebrew for Linux that might be helpful for you.