28

I was trying to permanently disable a 3rd party daemon, so I deleted its plist file from /Library/LaunchDaemons-- and then I realized that I hadn't done a launchctl unload on it first; trying after the fact yields "No such file or directory/nothing found to unload". And, of course the daemon is restartable, so when I kill it, it gets recreated.

I tried doing launchctl list in hopes of getting a label to use for launchctl remove but the daemon is no longer listed.

Short of rebooting, is there any way to get launchd to forget about the daemon and/or re-scan the configuration files?

1
  • The documentation is unclear, but launchctl kill com.example.product seems to work. May 16, 2018 at 0:24

2 Answers 2

36

To see ALL the daemons currently running, you need to type:

sudo launchctl list

Or sort them to nicely separate com.apple ones:

sudo launchctl list | sort

And then you can remove it, for example:

sudo launchctl remove com.sassafras.KeyAccess.daemon

Important Note : If you don't want to get daemons on machine reboot, then please remove associated plist file.

8
  • Huh, I guess if you're not root, it only shows the daemons launched for/as the user?
    – jhfrontz
    Dec 14, 2012 at 4:22
  • 6
    This doesn't actually work for me. The entries come back on reboot. Oct 11, 2014 at 16:34
  • 4
    @dimadima did you remove the associated plist file(s)? The commands provided by Dan only manipulate the current state (which is reset at next boot time to whatever is in /Library/LaunchDaemons).
    – jhfrontz
    Mar 4, 2015 at 17:50
  • @jhfrontz yup I've learned by now that you have to do that. Thank you. Mar 4, 2015 at 21:33
  • 1
    If it helps anyone, there are really always multiple unique lists available. All users in the directory have their own, although the root user and the logged in user are probably the most relevant. You can see all users who have processes with sudo ps aux or however you prefer then use sudo launchctl asuser [UniqueID] launchctl list to see the list for each user. Aug 3, 2018 at 5:47
5

Had the same issue today whereby the service continued to run under old label after the rename of the plist file. The service kept appearing in ps list and in sudo launchctl list.

The command that did the trick was bootout:

sudo launchctl bootout system/<label-obtained-from-launchctl-list>

Obviously, if the service is not in /Library/LaunchDaemons then one can do without sudo and system/ prefix (seems that system/ is a domain in launchd terminology).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .