How to remove a background service in macOS

Posted

Want to remove macOS services (a.k.a. daemons)?

In Windows, services are started by the Services Control Manager (services.exe) and controlled via the Services Manager console (services.msc) or sc command. In macOS, services are started by launchd and you'd use launchctl command instead. BTW, according to the man launchctl page, I'm using "legacy subcommands" below.

Listing Services

To check what services are running, run launchctl list. Note that there are two separate sets of services:

  • To get a list of services system-wide (a.k.a. system domain), sudo launchctl list,
  • To get a list of services running under your user profile (a.k.a. user domain), launchctl list | grep -v com.apple.

In both cases, to exclude everything that contains apple use launchctl list | grep -v com.apple (yes I know com.apple does not equal "com\.apple" which is more "correct").

Anyhoo, I respectively got lists like these:

~$ launchctl list | grep -v com.apple
PID Status  Label
-   0   com.openssh.ssh-agent
-   0   com.microsoft.update.agent
-   0   com.microsoft.VSCode.2728
-   0   com.microsoft.VSCode.ShipIt
64057   0   org.pqrs.karabiner.karabiner_console_user_server
-   0   com.oracle.java.Java-Updater

~$ sudo launchctl list | grep -v com.apple
PID Status  Label
53  0   org.pqrs.karabiner.karabiner_grabber
-   0   org.cups.cupsd
-   78  com.oracle.java.Helper-Tool
-   0   com.vix.cron
-   0   com.microsoft.office.licensingV2.helper
85  0   org.apache.httpd
-   0   com.microsoft.autoupdate.helper
-   -9  com.adobe.ARMDC.Communicator
-   -9  com.adobe.ARMDC.SMJobBlessHelper

I am the type of techie who likes to know what is running. I have posted about a few of these before: you need "cups" for printing, "apache" is a web server, and I use "karabiner" to re-map a key to function as Escape.

To get more info for a particular service run launchctl list [label], e.g. launchctl list com.openssh.ssh-agent or sudo launchctl list org.cups.cupsd as the appropriate user.

Stopping and Removing Services

Don't run the following commands, I am in in way suggesting you remove any service! This section is just for information only.

Hmmm, I felt there were a bunch of services I didn't want running, and I couldn't find a way to disable these background tasks via the app settings. Instead, one could run launchctl stop [label] to stop these unwanted services.

To remove the service, one could (but shouldn't) run launchctl remove [label]. I tried to remove com.oracle.java.Java-Updater and the Adobe services, and found that... once it's gone, it's gone for good - this is irreversible!

If you really want to get rid of the configuration files and executable too, you'll find the former in the folder /Library/LaunchDaemons/ and the latter in /Library/PrivilegedHelperTools/.

Warning and disclaimer: Seriously. Don't do any of this! I don't know what will happen if you do! You could brick your expensive MacBook, or as the man page puts it, "render your system unbootable!"