316

mds and mds_stores are constant CPU consumers even when I think nothing should have changed on the hard drive.

Activity Monitor:

activity monitor

I have a circa 2009 Macbook Pro with lots of software installed over the years. Dropbox and Crashplan are active background processes among many others.

I have included many locations in the privacy settings of Spotlight to exclude from its index:

  • USB drive
  • Crashplan folder
  • /Library/Caches
  • /Users/me/Library/Caches

Still, mds and mds_stores are constant consumers of CPU hovering around 10-12% each. My fan keeps running due to the heat.

Any ideas as to what it could be due and how I can troubleshoot?

0

15 Answers 15

373

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.

0
59

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
17
  • 7
    Thanks, it was really useful! But on my system (High Sierra), I had to replace mds_stores by mds to get useful output. Jun 21 '20 at 11:09
  • 7
    In any open dialog hit cmd-shift-dot to show hidden files , and Library will be shown Jun 30 '20 at 15:59
  • 2
    @MikeWilliamson The command will output files & folders being frequently indexed. Generally they will be files (cache or source files) that change frequently but you do not need indexed (i.e. accessible via spotlight). Typically they will cluster in particular directories. Just add the parent directories to your exclusion list. Aug 14 '20 at 19:05
  • 2
    @Phillip spotlight has value – to me it helps to narrow down it's scope as much as possible. only index the directories and file types that you need. both can be controlled with the Privacy Pref Pane. And discovering errant scans are done using the cmd i shared above. (fs_usage) Oct 29 '20 at 20:21
  • 1
    @AnthonyMetzidis There were something like at least hundreds of locations being listed, some of which I could not even discover in spotlight (such as /dev/disk1, I assume hidden) when running sudo fs_usage -w -f filesys mds_stores. I haven't yet re-enabled Spotlight but still have been able to use it (what has already been indexed). I'm sure I'll turn it back on at some point. Side note: It might not be causal, but I had just switched from being logged into Windows (Bootcamp) when I noticed mds_stores CPU usage. I added the Bootcamp drive to spotlight privacy, but it didn't slow mds_stores.
    – Phillip
    Oct 31 '20 at 1:19
16

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.

2
  • 7
    Doesn't work for me in MacOS 10.15.3. I get this message '"Volume Name” is a Time Machine backup folder. You cannot add it to the privacy list.' Feb 26 '20 at 23:32
  • yea how ll you make this work on osx 11.4
    – PirateApp
    Jun 13 at 8:59
12

If you have trouble it when mount external hard. check this article

Prevent Spotlight from indexing external drive

In my case, I solved it by creating .metadata_never_index file on the root path of external hard.

$ touch /Volumes/ExternalHard/.metadata_never_index

Hope it help someone.

8

I got the same issue, almost bought me a new mac. I checked all the stuff on the net about mds_stores etc... All I got was terminal programming and clean installation solutions.. without guarantees of fixing the problem.

So I checked my free-to-download cleaning and maintenance tool "Onyx" and in the navigation bar under maintenance you can check "Spotlight Rebuild" (as default is unchecked).

After that I had no problems and speed was up to normal. Also, Activity Monitor stays within normal parameters. I hope it stays that way and works. For it is an easy and free tip for non-technical Mac users.

Found that out an hour ago but looks promising. Goodluck

0
6

As other answers mentioned, Spotlight indexing is likely the cause of this issue. If you want to exclude folders or disks from being indexed using the UI, (as of macOS 10.15 Catalina) you can add them in System Preferences -> Spotlight -> Privacy

System Preferences dialog

Spotlight Privacy dialog

5

I had this same issue. I went into Security & Privacy System Preference, just to look at what Spotlight was including. I checked one thing off and then back on again and it immediately stopped. Mine was using almost 100% CPU power and my fans were running nonstop. It all stopped after I did this and I have no idea why. I have a Mid 2012 MacBook Pro.

1
2

This was driving me insane, Task Manager was recording 50-500mb/sec read operations while computer was idle, and I narrowed it down to MDS.

tldr; Summary steps:

  1. Add all folders (including hidden) under Macintosh HD to Spotlight exclusion.
  2. Remove Applications and Users folder, and anything else you need.

Here were my steps to diagnose this as the problem:

  1. Open Activity Monitor in stable-state, see massive read/sec. Verify MDS has read/written the most bytes.
  2. Open Spotlight in Settings
  3. Drag in "Macintosh HD" to exclusions
  4. Restart computer
  5. Open Activity Monitor
  6. Wait for steady-state, see read/sec down to <100kb (woohoo!).

Now the tricky part -- have to figure out what in "Macintosh Hd" is causing the issue and exclude.

  1. Re-open Spotlight Settings
  2. Clean up any exclusions that were noise in trying to figure this out, just leaving Macintosh HD and any others you know might be trouble-makers. For me I left: Shared, System, Unreal Engine, VirtualBox VMs
  3. Click "+" to add an exclusion, and go into Macintosh HD.
  4. IMPORTANT: Type cmd+shift+. to show hidden folders, which there should be many.
  5. Select all (cmd+a) then "Okay". Might get a couple of errors, which seems fine.
  6. Wait for steady-state and re-verify <100kb read/sec times.
  7. Remove "Macintosh HD" from the list with (-) button.
  8. Wait for steady-state and <100kb read/sec again. This took my computer ~2 minutes, presumably because it's indexing some of the folders which didn't make the exclusion list because of the errors. Press cmd+space to open spotlight, and enter some text like "a". Notice that right under the search bar, spotlight has a progress bar that says it's indexing even though it's only consuming <100kb/sec read (not consistent, sometimes takes 5 minutes to show up even after it starts). Not sure what's going on here, perhaps a bunch of very small files, but either way wait for it to finish. Once finished, it should go near almost 0 read/sec.
  9. Remove added folders one-by-one, repeating the process of waiting for both the progress bar and disk read/sec to go to zero. My removals in order were: Applications, Users, Volumes, .vol, bin, etc, cores, tmp, Unreal Engine, VirtualBox, opt, Shared, sbin, etcetera. Took about an hour per added folder to get back to <100kb/sec read. Enjoy!
1

I'm on Apple M1 and I don't have any external hard-drive connected. I have a folder on desktop which includes all my NodeJS projects. Since it is a working directory and lots of files and folders keep getting added/removed from it, I included it in the list for preventing spotlight from searching it:

Spotlight >> Privacy >> Prevent Spotlight from searching these locations

enter image description here

Good Luck...

0

After trying everything there is on the web and forums, and nothing worked - a smart guy (Lincoln Adams) on the Apple forum with the same issue, made a mind blowing discovery: In his case (and mine, and maybe yours) - this was caused by the Pinterest button/extension in Firefox. Try closing Firefox, rebooting, and using another browser for a while. The thread on Apple forums

0

if figured out when running the command sudo mdutil -a -i off that spotlight is trying to index a USB connected drive of one Terabyte. I disconnected it and restarted the computer.

0

I had this problem and it persisted even after disabling spotlight search. ALthough I don’t have the pinterest extension mentioned above, I found that closing Firefox solved the issue.

0

When you close Spotlight by clicking outside it retains the text you entered in the text box. Deleting the text calmed the process down. My advice is to click/tap Esc two times when you're done with Spotlight. The first click clears the text box, the second one closes Spotlight.

0

From what I know that number is not a 100% based usage, i.e. that 11.9 and 9.6 do not mean it takes up 11.9% and 9.6% of the whole CPU processing power.

For a dual core CPU, 10 in that column means it used up 10% of a core only, i.e. 5% of the whole CPU.

So for a 8 cores CPU, 100% usage of the whole CPU the number showed for a process should be 800 but not 100.

I assume your mac is a dual core CPU, 11.9 and 9.6 in total is not costing as much as you thought.

It should works the same way as top command works in Linux

-7

You said, "I have included many locations in the privacy settings of spotlight."
You need to include FEWER locations, not more. If you include more, that means Spotlight is keeping very busy looking at them all.
You can easily go to System Preferences/Spotlight to un-select many locations. Especially, un-select Mail, search engines, and other internet dependent options.
Shut down and restart after changing your Spotlight preferences.

2
  • 10
    You are mistaken, in fact you have it back to front, the privacy panel of Spotlight says, and I quote: "Prevent Spotlight from searching these locations" so having fewer locations in privacy will actually cause spotlight to keep BUSIER. Having more locations unchecked in the Search Results panel will do as you say but the more you put in the privacy panel the less spotlight will search.
    – sdjuan
    Oct 6 '16 at 4:25
  • 3
    Yes, this is actually quite bad advice. Anything you don't want scanned should be in Privacy. Jan 26 '17 at 17:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .