How to Clear the macOS CoreRoutine Location Cache via Terminal

The Silent Tracker

Have you ever noticed that when you open the Maps app on your Mac, it often accurately guesses your home or work location, or suggests when you should leave for an upcoming calendar appointment based on current traffic? This proactive spatial intelligence is powered by a hidden background framework called CoreRoutine.

CoreRoutine (specifically the routined daemon) silently collects data from your Wi-Fi connections, Bluetooth beacons, and Apple ID location services to build a highly accurate, historical database of your Significant Locations. This data is kept strictly local on your Mac and is encrypted, meaning not even Apple can read it.

However, if this location database becomes corrupted, the routined daemon can get caught in an infinite loop. This manifests as a severe battery drain, random spikes in CPU usage by the routined process in Activity Monitor, or the Maps app instantly crashing when attempting to load a route. To fix this, you must forcefully clear the CoreRoutine location cache using the Terminal.

Locating the CoreRoutine Database

Because this database contains highly sensitive tracking data regarding your daily movements, macOS protects it heavily. It is stored deep within the system-level user directories.

The databases are located at: /var/db/locationd/Library/SpacialKnowledge/

Purging the Cache via Terminal

You cannot access this folder through the graphical Finder interface. You must use the Terminal with elevated (sudo) administrator privileges to access and delete the files.

  1. Open the Terminal application.
  2. Execute the following command to forcefully remove the tracking databases:
sudo rm -rf /var/db/locationd/Library/SpacialKnowledge/*

Press Enter, type your Mac’s administrator password (the cursor will not move while you type), and press Enter again.

Restarting the Location Daemons

Simply deleting the files on the hard drive is insufficient. The background daemon (routined) is currently active in memory and is actively attempting to write new location points to the database you just deleted.

You must forcefully terminate the location daemons to clear their memory state.

sudo killall routined
sudo killall locationd

The moment you execute the second command, you might notice the small Location Services arrow briefly disappear from your macOS menu bar. This is normal. macOS’s launchd architecture will instantly respawn fresh, clean instances of both daemons.

Rebuilding the Knowledge

When the routined daemon restarts, it will generate a brand-new, empty SQLite database. The severe CPU usage and battery drain will instantly cease.

Be aware that your Mac has effectively lost its memory of your daily commute. Over the next several weeks, as you carry your MacBook between your home, office, and local coffee shops, CoreRoutine will slowly rebuild its map of your Significant Locations from scratch.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.