The Analytics Engine
In modern macOS, Apple heavily relies on telemetry data to improve the operating system and diagnose battery drain or application crashes. This data is collected, aggregated, and stored locally by the CoreAnalytics framework before being occasionally dispatched to Apple’s servers (if you opted into sending analytic data during the Mac setup process).
The background daemon responsible for this is analyticsd. Under normal circumstances, it is entirely invisible. However, if the SQLite database holding the telemetry data becomes corrupted, or if a specific application begins generating thousands of crash reports per second, the CoreAnalytics database can become massive. The analyticsd process will suddenly spike to 100% CPU usage as it desperately tries to parse the corrupted data, causing your Mac’s fans to spin up to maximum speed and draining the battery.
To resolve this CPU spike and eliminate the corrupted telemetry database, you must forcefully clear the CoreAnalytics cache using the Terminal.
Locating the Cache Directory
Because CoreAnalytics collects data for the entire system, its database files are heavily protected within the root system directories, not your user folder.
The database files are located at: /Library/Logs/DiagnosticReports/ and /var/db/analyticsd/
Purging the Database via Terminal
You cannot simply drag these files to the Trash. You must use the Terminal with elevated (sudo) administrator privileges to access and delete the restricted databases.
- Open the Terminal application.
- Execute the following command to forcefully remove the active Analytics database directory:
sudo rm -rf /var/db/analyticsd/*
Press Enter, type your Mac’s administrator password (the characters will remain invisible), and press Enter again.
Next, you should clear the massive backlog of crash reports that might be feeding the corrupted daemon:
sudo rm -rf /Library/Logs/DiagnosticReports/*
Restarting the Analytics Daemon
Deleting the files from the SSD does not solve the CPU spike immediately. The background analyticsd process is still running in memory, furiously trying to read the database files that you just deleted.
You must forcefully terminate the daemon to clear its memory state.
sudo killall analyticsd
Press Enter. You should instantly notice the CPU usage in Activity Monitor drop, and the fans will slowly begin to quiet down.
The Rebuilding Phase
The moment you terminate the daemon, macOS’s launchd architecture will automatically and silently respawn a fresh instance of analyticsd. When the daemon boots up, it will realize that the /var/db/analyticsd/ directory is empty. It will automatically generate a brand-new, clean SQLite database to begin storing future telemetry data.
You have successfully destroyed the corrupted database and permanently resolved the associated performance drain.