40

I have installed postgresql via HomeBrew. It worked but today I find that postgresql server does not run when computer start.

I try to use launchctl to load it again with below command:

$ launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist

and I see the message:

/usr/local/Cellar/postgresql/9.3.4/homebrew.mxcl.postgresql.plist: Service is disabled

I do not know how to enable postgresql service. Could anyone show me?

Minh Ha Pham
  • 2,566
  • 2
  • 28
  • 43

3 Answers3

86

Use -w option with launchctl.

$ launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist 

-w Overrides the Disabled key and sets it to false.

Parag Bafna
  • 22,812
  • 8
  • 71
  • 144
  • 6
    In Yosemite that should be `launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist`. – Zubin Oct 19 '14 at 02:56
  • Where does `-w` put the "Disabled" override? After running this command, I can't find it in `/private/var/db/launchd.db/com.apple.launchd/overrides.plist`. – Matt Oct 22 '14 at 15:57
  • 8
    However, how did that get disabled in the first place though? Ran into the same problem for no apparent reason, just curious... – xji Feb 25 '15 at 07:40
  • Avoiding a me-too here, but Googling for a similar problem with redis brought me to this page and answer. the `-w` works for redis as well – wndxlori Mar 07 '16 at 17:49
5

The new way as brew info postgresql says:

brew services start postgresql
KARASZI István
  • 30,900
  • 8
  • 101
  • 128
1

It might also be helpful to use the command brew info postgresql for suggestions about how to set up your database and move the plist file into ~/Library/LaunchAgents

gards
  • 555
  • 1
  • 6
  • 18