Setting up a development environment on a new machine, brew installed postgres. Now I need to initdb
for the first time, which directory should i specify for this command?
Asked
Active
Viewed 4,942 times
2

jbk
- 1,911
- 19
- 36
-
Anything you choose. That's why it is a parameter... – wildplasser Nov 21 '16 at 00:38
2 Answers
4
Assuming you're on OS X, given "brew", then:
If you intend to run the postgres server under your own user account, put it somewhere like
/Users/MyUserName/Library/postgres_data
.If you intend to run it from
launchd
as a system service, as a dedicated postgres user, put it somewhere in/Library/
.
However, Homebrew takes this out of your hands a bit with brew services
:
brew tap homebrew/services
which I recommend using. I don't have a Mac and the docs appear to be nonexistent for this, but it looks like it's as simple as:
brew services start postgres
If not, the interactive help will probably tell you what you need to do.

Craig Ringer
- 307,061
- 76
- 688
- 778