I was reading through the launchctl man page and have a few questions about its functioning:
- What is the difference between load and start, unload and stop?
- Where do I find the job label for a daemon, is it in the plist file?
launchd
I was reading through the launchctl man page and have a few questions about its functioning:
Best Answer
TL;DR
launchctl load -w
andlaunchctl unload -w
.start
andstop
are usually reserved for testing or debugging a job.Details
launchctl start <label>
: Starts the job. This is usually reserved just for testing or debugging a particular job.launchctl stop <label>
: Stops the job. Opposite of start, and it's possible that the job will immediately restart if the job is configured to stay running.launchctl remove <label>
: Removes the job fromlaunchd
, but asynchronously. It will not wait for the job to actually stop before returning, so no error handling on this one.launchctl load <path>
: Loads and starts the job as long as the job is not "disabled."launchctl unload <path>
: Stops and unloads the job. The job will still restart on the next login/reboot.launchctl load -w <path>
: Loads and starts the job while also marking the job as "not disabled." The job will restart on the next login/reboot.launchctl unload -w <path>
: Stops and unloads and disables the job. The job will NOT restart on the next login/restart.Yes, it's in the plist file and it typically matches the filename of the plist file.