Apple - mds and mds_stores constantly consuming cpu

As you know, the mds and mds_stores are Spotlight activities.

The reason why your Spotlight is so active could be a number of things; it could be you have an app or multiple apps constantly changing some folder contents.

First let's check whether Spotlight is the cause of the fans running so much. To test this, run the following in your terminal:

sudo mdutil -a -i off

this turns off indexing of files, and should result in a clear slow down of the fans if mds and/or mds_stores are to blame.

To turn indexing back on, run

sudo mdutil -a -i on

After this you could run the complete re-indexing of your hard drive (be aware this could be an over night job), it will delete your Spotlight data base forcing it to start over.

sudo rm -rf /.Spotlight-V100/*

The next and final step would be to add others to your (do not scan), privacy settings.


It's best to find high-volume directories and omit them from indexing using Spotlight->Privacy settings.

  1. In terminal call fs_usage to list files being indexed by mds_stores

    ~ sudo fs_usage -w -f filesys mds_stores

    0.000227 W Google Chrome He.789992
    12:13:46.660891    WrData[S]       D=0x03a7d92b  B=0x1000   /dev/disk1s1  /Users/XXX/Library/Caches/Google/Chrome/Default/Cache/73f8ce7b565cc7be_0                                                                        0.000297 W Google Chrome He.789992
    
  2. add those directories to the exclusion list in System Preferences → Spotlight → Privacy

Just to add a small tip on top of @Buscar웃 's correct answer: In my case, I realized that spotlight was actually indexing Time Machine backups (which is really a stupid thing to do in the first place). To me, this explains the constant CPU in the first place - TimeMachine creates an hourly backup, Spotlight tries to index it... After stopping the indexing service and removing existing indexes as indicated above, and before re-starting the indexing, I also excluded the TimeMachine volumes (open finder, go --> go to folder --> /Volumes, and then drag the TimeMachine volume to the exclude list of Spotlight). Fingers crossed.