Service management utility for Mac OSX (launchctl helper)
service php restart
. On Mac, this is more like:
launchctl unload ~/Library/LaunchAgents/homebrew-php.josegonzalez.php55.plist
launchctl load ~/Library/LaunchAgents/homebrew-php.josegonzalez.php55.plist
Which is ugly, hard to remember and launchctl has no way of listing all available services. Plus, those plist can reside in all those directories:
- /System/Library/LaunchDaemons
- /System/Library/LaunchAgent
- /Library/LaunchDaemons
- /Library/LaunchAgents
- ~/Library/LaunchAgents
This is why I can up with an utility to manage services. It searches in all directories above for your service, prompts for sudo if it is in a system directory and provide goodies like
restart
, reload
and link
.Usage:
service selfupdate
- update from the Gist
service php
- searches for a plist containing 'php'
service php load|unload|reload
- insert or remove a plist from launchctl
service php start|stop|restart
- manage a daemon, but leave it in launchctl (does not work with Agents)
service php link
- If you use Homebrew, which you should, it will link the plist of this Formula into ~/Library/LaunchAgents, reloading if needed. Very useful when upgrading.