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?

3 Answers 3

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.

4
  • 6
    In Yosemite that should be launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist.
    – Zubin
    Commented Oct 19, 2014 at 2: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
    Commented Oct 22, 2014 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
    Commented Feb 25, 2015 at 7: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
    Commented Mar 7, 2016 at 17:49
5

The new way as brew info postgresql says:

brew services start postgresql
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

Not the answer you're looking for? Browse other questions tagged or ask your own question.