Systemstats process causing a high CPU load

Published in MacOS on Apr 21, 2022

I recently noticed that my MacBook Pro fans kept running all day on full blast. I'm used to fan noise caused by apps like Zoom or by running an automated test suite, but they usually go silent when I quit the offending app or when the resource-intensive process terminates.

Upon further inspection, Activity Monitor showed that a process called "systemstats" was consistently using 40% of my CPU. At a later time, it even went up to a 100% and just stayed there. Systemstats is part of the MacOS system, so it wasn't a simple matter of uninstalling something.

So I tried all the usual things:

  • Kill the process. Helped for a little while, then it came back again.
  • "Have tried turning it off and on again": a reboot helped for a little while longer, but not much.
  • The infamous PRAM and SMC reset. Didn't do anything - for the record, in all those years, this hasn't solved any issue to date.

The only option left was a complete re-install. Or was it?

Database corruption

I wasn't looking forward to rebuilding my faithful system, so I kept on Googling for this particular problem. I came across an older MacRumors post which mentioned a cause I didn't consider yet: a corrupted database. The solution would be to delete the current database and allow Systemstats to create a new one after a reboot.

I tried to rename the current database from within MacOS, but it turned out these files are protected by the OS (System Integrity Protection). I needed a bigger gun.

The solution

The solution was pretty simple:

  1. I rebooted my Mac into Recovery Mode by pressing CMD+R during boot.
  2. Entered the required credentials to proceed.
  3. Started Disk Utility to mount the Data volume of my SSD (it's suffixed by "- Data" in the list of volumes). After mounting, I closed the utility.
  4. Opened the Terminal using the menu bar.
  5. Used mv /private/var/db/systemstats /private/var/db/systemstats_old to rename the folder.
  6. Rebooted again and observed the systemstats process.
  7. It kept using less than 1% CPU even after more than a couple of hours, so I opened a terminal once again and removed the old database using sudo rm -rf /private/var/db/systemstats_old.

After two days everything still works, the process hasn't misbehaved yet and my Macbook is all quiet again!