If you use a mac, then you should be using Homebrew to manage your packages. If you use Homebrew, you’ll notice that a lot of the services that you install will be controlled via launchd, which is a Mac OS framework for managing (starting / stopping) services.
What they recommend is to put load these scripts with something like
launchctl load, which will keep the service up, and restart it each time your machine restarts.
That’s kind of annoying, since most of the time you don’t need Postgres, mongodb, and Redis running in the background while you check your email.
You can use
launchctl directly to stop and start
launchd services, but its kind of annoying, since you need to specify the full path of the
plist file you want to control. I prefer to use a little Ruby gem called lunchy on my machines.
Its a nice wrapper around
launchctl and the basic usage is:
- `lunchy status` will show you what services are running
- `lunchy [stop/start]
` will start and stop a service by name</li> </ul> The cool part about
lunchy [stop/start]is that you don't need to specify the full path, but can just specify a substring of the path. If only one is found, it will work with that service. So, instead of: You can use: Also, when using
lunchy, I prefer to never run the
launchctl -w load(which will make things restart on system load) anything, but only do the
cpof the Homebrew instructions. If you've already got things set to
-w, you can set them back with
launchctl -w unloadon each plist in