2

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?

jbk
  • 1,911
  • 19
  • 36

2 Answers2

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
0

It seems brew failed to create a database when installing postgres, the solution for me, as found here, was to run createdb then all was fine.

Community
  • 1
  • 1
jbk
  • 1,911
  • 19
  • 36