How to: Get Spotlight processes back under control when CPU usage goes crazy
If you’re finding that your Mac fans are running a lot more than they used to, you might want to check out whether a couple of Spotlight processes are consuming more than their fair share of CPU cycles.
Ever since the latest Mavericks update, I found that my MacBook Pro seemed to be running hot a lot of the time, with fans ramping up to high levels to cool it. Checking Activity Monitor didn’t seem to be shedding much light on things at first glance. The only two processes using an unusual amount of CPU were mds and mds_stores. These are two processes used by Spotlight when indexing, so I didn’t think too much of it – Spotlight has to do its indexing sometime, right?
But several checks later, these two processes seemed to be helping themselves to significant chunks of CPU on a regular basis, at which point I did some Googling.
I started by disabling Spotlight altogether to confirm that it was the culprit. To do this, I went into Terminal and entered:
sudo mdutil -a -i off
The fans spooled down and all was back to normal. Spotlight was indeed the culprit.
I briefly considered leaving Spotlight off until the next OS X update, but that proved too much of a pain. I keep my most-used apps in the dock, but everything else I habitually launch from Spotlight. CMD-space plus the first letter or two of the app is just too convenient to give up. So I did some more Googling – after switching Spotlight back on with:
sudo mdutil -a -i on
The first tip I found was here, where it suggested deleting the Spotlight database and forcing it to re-index. You can do this in Terminal again:
sudo rm -rf /.Spotlight-V100/*
Top tip: set this going overnight, as the re-indexing takes a while.
This helped quite a bit, but the mds process still seemed a little greedy. More Googling led me to a suggestion to remove from Spotlight’s indexing any directories with frequently-changing content, especially those used for online backup. You can do this by going into System Preferences, clicking the Privacy tab and then drag-and-dropping onto it any directories you don’t want it to index.
I added my CrashPlan, MobileSync and Dropbox folders – three specific suggestions I’d found – and then for good measure added some others with frequently-changing content.
This did the trick: my fans stayed on low, and Activity Monitor showed the mds processes consuming only tiny amounts of CPU.
I’m not sure how general an issue this – hence making this an aside – but if you’re finding your Mac running hot, it may be worth checking out.