2

One or another of the various macOS background daemons that comes with the operating system is always popping up and using a ton of CPU in the background. This is generally slightly bothersome, but it's really annoying while I'm trying to play demanding video games that really need the system's full attention. This visibly hurts the framerate and I need to go and investigate in iStat Menus or something to nuke the offending process manually.

Is there a way to comprehensively pause or at least aggressively throttle all system background activity while I'm doing something demanding? Mostly I want this for applications that are demanding of input responsiveness, like video games, but it would be nice for CPU intensive batch jobs that might take an hour or two to run, too; tell the system to please chill out in the background and not suck up either CPU or I/O to let the jobs run either more repsonsively or faster.

I'm being non-specific because “Why is daemon X taking up so much CPU” is a common genre of question on this site and others like it (previously, previously, previously, previously, previously, previously, previously, previously, previously, previously, previously). All of these daemons are implicated at various points. Probably the worst offenders are syspolicyd, AMPDevicesAgent, and worst of all suggestd, but all the usual suspects show up at one point or another.

As such, I'm not looking for a permanent answer for how to fix these problems all the time, i.e. how to make these daemons go away, because:

  1. There's too many of them; I am resigned to just having weird energy leaks and performance problems until Apple provides some more transparency for their background daemons.
  2. At least for right now, they're mostly behaving themselves most of the time, and I realize they provide value by indexing things and doing stuff in the background to provide responsiveness in the moment.
  3. With an Apple Silicon machine, they appear to mostly be persistently scheduled onto the Efficiency cores and have less of a devastating performance and battery impact than they used to, as a result.

What I'm looking for is more of a temporary fix for when I need maximum performance, which would allow me to simply quiet down the background performance interference rather than shutting it down completely. I know the system needs this stuff to run for all the functionality to work and I don't want to take an axe to necessary parts of the OS, but I'd also like to get a consistent 120 FPS in 5-year-old games without dropping to 2-3FPS for a minute and getting killed because it was really important to Mail.app to make sure I could instantly search for some direct marketer's phone number because it downloaded a new message into its spam folder.

6
  • 1
    Maybe just shutdown Mail and other applications while you are gaming? Or create a gaming account and log out of the main account to play games?
    – nohillside
    Commented Jun 10, 2022 at 8:21
  • 1
    The applications are shut down. The Mail.app example is because suggestd is scanning Mail’s database, among others, sporadically in the background regardless of whether the app is open. Making a second account has no effect because many of these background services are system-wide and don’t require my main user to be logged in to run and consume CPU.
    – Glyph
    Commented Jun 10, 2022 at 8:40
  • We used to run CFD very intensive tasks on Silicon Graphics machine ie Unix, and used 99% of the cpu - the system still has to do housekeeping even in the background and those tasks would be running for 40 days or more.
    – Solar Mike
    Commented Jun 10, 2022 at 9:21
  • Are we looking at processes which are running all the time, or at processes which get launched, run a few seconds and disappear again til triggered again? The first group you could pause by sending the appropriate signal from Terminal.
    – nohillside
    Commented Jun 10, 2022 at 9:52
  • A mix. Systemstats seems to be launched periodically but then exit. AMPDevicesAgent launches when iOS devices are syncing, which is pretty frequent but not always. Suggestd is running all the time, mds seems to have a pool of workers who live for a while and then get periodically reaped. There’s not a really clear pattern.
    – Glyph
    Commented Jun 11, 2022 at 2:00

4 Answers 4

5

The answer to this is that it was a missing feature in macOS, and in macOS Sonoma now has Game Mode, which will have no configuration, but the OS should detect full-screen games and prioritize them.

Update 2024-08-26: In my experience, this feature doesn't work. In fact, it anti-works. It automatically activates in most games (Minecraft, Baldur's Gate 3, Borderlands 2, to name a few) and if I leave it on, it tanks my framerate and makes my input latency absolutely horrible. So the question remains open.

0
1

As nohillside suggested, using pkill -STOP suggestd works just fine. The process will be kept in the state "sleeping" once the command is executed (visible in the activity monitor, but using 0% CPU) (Note: I've checked the processes for more than five days and they were kept in "sleeping" mode.). If you want to prevent such processes from getting activated automatically, add the command into .bashrc (or other config). For example, in my case I have the following lines in .zshrc:

pkill -STOP suggestd
pkill -STOP photoanalysisd
pkill -STOP photolibraryd
pkill -STOP cloudphotod

Those processes will be running, but not using any CPU, because they will be "sleeping". You can verify the state yourself by finding the PID of the process and then looking at its state with top:

pgrep suggestd
# outputs <PID>
top -pid <PID>
# look for column `state`, it should be `sleeping`
4
  • This is not a great answer, for a few reasons. Some of these processes will idle out and get killed and restarted if they're hung for too long, which STOP will do. Also, this is not a comprehensive catalogue of all the background processes. If you see my comment in the other answer you can see that this is an insufficient list, as it does not include syspolicyd, systemstats, mds_stores, backupd, deleted, tccd, AMDDevicesAgent,AMPDeviceDiscoveryAgent, usbmuxd, cloudphotod, photoanalysisd, opendirectoryd, CalendarAgent, sharingd, cloudd, calaccessd (and so on)
    – Glyph
    Commented Nov 30, 2023 at 18:07
  • 1
    First, I didn't restart my macbook for about 5 days and checked the state of the processes I mentioned above regularly (about twice a day). None of those processes were restarted and have been kept "sleeping". Please try out sleeping the processes and report back if it does not work. Second, I did not claim that this is an exhaustive list. I gave examples. Further services can be looked up via activity monitor (the ones that cause an FPS drop). Note that the person who asked this question is not looking for a "blanket answer" either. Commented Dec 4, 2023 at 22:04
  • I am the person who asked the question. My phrasing with "blanket answer" about "fixing" the problems was awkward. I'll edit the question at some point, but what I was trying to express was that I did not want a fix to make these daemons go away, since that would break functionality, what I wanted was a temporary pause button.
    – Glyph
    Commented Dec 6, 2023 at 2:44
  • I should also say, though, thank you @dichotomies for doing that investigative work, that's a lot of effort to verifying our understanding here!
    – Glyph
    Commented Dec 6, 2023 at 17:38
0

You can pause long-running background processes like suggestd by running

pkill -STOP suggestd

To let it continue, use pkill -CONT suggestd (or reboot).

4
  • 1
    The major problem with this answer is that many of the processes are either periodically restarted, spawned on demand, or heartbeating and killed/restarted if they don’t respond. It varies per daemon which is why I’m looking for a system-wide setting.
    – Glyph
    Commented Jun 11, 2022 at 1:58
  • @glyph there is no system-wide setting. Please list all relevant processes in the question so people can find a solution.
    – nohillside
    Commented Jun 11, 2022 at 4:48
  • I am not sure I can fully enumerate the list (the whole point here is that I don't want to learn about each new CPU leak by hitting a nasty frame drop in the middle of a multiplayer game), but off the top of my head: syspolicyd, systemstats, mds_stores, backupd, deleted, tccd, AMDDevicesAgent, usbmuxd, cloudphotod, photoanalysisd, opendirectoryd, CalendarAgent .
    – Glyph
    Commented Jun 12, 2022 at 1:38
  • @glyph Please add this to the question then. LaunchDaemons can be paused as well usually, so it basically a little script which stops/restarts processes and daemons. A script you may need to extend if you find additional processes.
    – nohillside
    Commented Jun 12, 2022 at 10:51
0

I wouldn't suggest killing these daemons as some of them are actually essential for the Mac to run. First install homebrew in terminal if you don't already have it. Then install top through homebrew. Locate the daemon that is hogging the cpu. You can validate if it is actually hogging the cpu by its corresponding % core usage. Click the nice + button. Nice is the prioritising order that you can play around with. 0 is default, as you increase the nice level, it loses priority to cpu space. 20 is the bottom of the pecking order. Whereas if you go downwards(negative) from 0, it increases the priority, and -20 is top priority. Htop allows you to increase the nice/decrease the priority, but not the other way without root permission.

So locate the daemon and crank its ice value up. If you don't want it to ever bother you again, max it up at 20. but it means if the cpu is running short on space, that daemon will never get around to running. So use this with care.

1
  • This is good information to know so I've upvoted it, but it doesn't really address the question because the I/O scheduler and the CPU scheduler are different things. Most of these daemons are already "niced" well beyond the deprioritization of standard unix nice, because they're pinned to the efficiency cores (see apple.stackexchange.com/questions/443713/… ) and the issue is GPU or disk bandwidth that affects the game's performance.
    – Glyph
    Commented Aug 29 at 2:12

You must log in to answer this question.

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