Hidden background apps may be slowing down your Mac. Here's how to fix that potential impact to your Mac's performance.
In any UNIX-based computer system, including macOS, the operating system runs a variety of background processes to perform certain tasks silently. On macOS, these are generally divided into two categories: daemons and agents.
A daemon is a faceless background task that runs continuously to perform some tasks. There are several common daemons on macOS: launchd to launch other processes, accounts (which manages user accounts), cloudd - which runs iCloud services, bluetoothd - for BlueTooth services, and many others.
Similar to daemons are agents, background apps that are allowed to interact with foreground applications and occasionally present small user interfaces. securityd is one such example, as you see this agent in action every time your Mac asks for an administrator password.
You can view most processes, including daemons and agents, running on your Mac by opening macOS's Activity Monitor app located in the Utilities folder on your Startup Disk. You can also see details about running processes in Terminal by typing
top and pressing Return.
Most of Apple's system daemons and agents have been well-refined over the years. After decades of development, they run smoothly and seamlessly, so you hardly ever notice them running.
But third-party daemons and agents also exist. If they are poorly written, they can perform badly, hog CPU time, cause excessive disk access, and otherwise behave in ways that can slow down your Mac.
Currently on macOS, daemons and agents live in two folders inside your /Library folder: LaunchAgents and LaunchDaemons.
Actually, the daemon and agent binaries that get executed don't live in these folders - instead .plist, or property list files live in both locations. .plist files are XML files that contain key-value pairs - with each key being a name with a corresponding value.
There is also a second LaunchAgents folder in your user's Library folder. You can open and view .plist files in most text editors, or in Apple's own IDE, Xcode.
Each .plist file contains a description of each daemon or agent, along with additional data which tells the system when and how to run it. One field in each .plist is named "ProgramArguments", which is an array of items including paths in the file system where the binaries to be run actually reside.
For example in the XQuartz org.xquartz.startx.plist file in the /Library/LaunchAgents folder, the ProgramArguments array contains four text items, three of which contain paths into other parts of the file system:
Each of these three paths points to binaries to be run by the system at various times, all of them in the invisible /opt folder installed by XQuartz at install time. Some .plists can also contain launch information for each daemon or agent, such as at what interval to launch them, and for how long.
Additional fields in the .plist in this example include a UNIX socket parameter, a "ServiceIPC" key, and an "EnableTransactions" key.
"IPC" is short for Interprocess Communication. Think of IPC (or in Apple's terminology, XPC) as a pipe connecting two processes on your Mac along which communication travels.
When your Mac starts up, macOS rifles through the LaunchAgents and LaunchDaemons folders, reading all the .plist files. It also makes notes about what needs to be launched, where those items live on disk, at what interval to launch them, and for how long to allow them to run.
When the specified time comes, the binaries at the indicated paths are launched and run. Some daemons and agents run continuously, while some only run periodically.
Automatic updaters are good examples of daemons that get run every so often, then quit after they have finished their update tasks.
Poorly written daemons
If a daemon or agent is poorly written it can be inefficient and run slowly, dragging overall system performance down. If a daemon's code is too slow, or takes too long to complete some tasks, or if it consumes too much CPU time, it can slow down the system.
If many such poorly written daemons and agents run at once, you will feel a noticeable slowdown in overall system performance.
Privileged helper tools
Also in your Mac's Library folder is another folder called "PrivilegedHelperTools". These binaries also get launched via .plist files stored in LaunchAgents and LaunchDaemons.
A privileged helper tool is a one-shot executable binary that runs briefly, and only because it must raise its privilege level on the system, perform a secure task, and then quit.
Some tasks on macOS require superuser access and thus would become security risks if left running continuously. Hence helper tools reduce any attack surface by only running briefly.
The logic is that if a task isn't running as superuser, it's more difficult to exploit it as an attack vector from a malicious piece of software.
Removing slow daemons and agents
As mentioned, if too many daemons and agents run at once on your Mac, or if one or more of them is poorly written, it can slow your Mac down. In order to regain normal performance in these cases, you'll need to identify which daemons or agents are causing performance problems, and then disable their .plist files and Restart your Mac.
For example, some agents that get installed as part of some third-party game engines are known to run slowly or drag the system down. In these cases, you may want to move their .plist files aside and then restart, which will prevent them from launching.
Note that it's not necessary to completely uninstall the offending software — it's only required that you move their corresponding. plist files out of the LaunchAgents and LaunchDaemons folders in all installed locations and restart. Later, if you want to use the software again, you can move the .plist files back into place, or reinstall the software and restart again to restore functionality.
To see which daemons and agents are using the most system resources, you can run Apple's Activity monitor, and check both the "% CPU" and "Threads" columns. These provide clues as to which processes are putting the heaviest load on your Mac's CPUs.
You can also check memory, energy, disk, and network usage using Activity Monitor.
Once you've determined which background processes are hogging your system's resources, you can head back to the LaunchAgents and LaunchDaemons folders, and drag their corresponding .plist files out of those folders. You'll need to organize and keep track of the .plist files so that you know where to move them back when you want to restore functionality.
In order to move the .plist files out of their installed folders, you'll need to enter an admin password when the Finder prompts you. Don't forget to restart your Mac.
One other possible option is to modify the contents of each .plist file if they contain launch intervals and times - for example, you might try increasing the launch interval in each .plist file in order to cause each daemon to run less frequently.
But be extremely careful when making these modifications since doing so can change the functionality of the installed software.
Daemons and agents designed to run continuously do so for a reason - usually to provide some background service or a service to a foreground app. Disabling them will cause a loss of functionality if they're not running when an application expects them to be.
Less is more
In general, you want to run as few daemons and agents on your system as possible. Even if all of them are well written, each one that is added puts some load on the system and CPUs, even if it's a tiny amount.
If you have several dozen daemons and agents running at once, it all adds up and will begin to slow down your Mac.
After you install a new software package, you may want to check the LaunchAgents and LaunchDaemons folders to see what got installed and whether you need them or not.
If you're interested in an in-depth, developer-level view of how daemons and agents work on macOS, check out Mac Daemonology by Volodymyr Vashurkin available from APRESS books.
You can also get a detailed technical discussion of how Apple's XPC services work on its developer webpage.