434

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

525

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 will turn 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 /System/Volumes/Data/.Spotlight-V100/*

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

8
  • 17
    I wonder why Apple doesn't address this problem in a proper way. Utilizing CPU for over 100% shouldn't be a behavior of good software. My MBP is already overheated. :( Mar 6, 2022 at 5:50
  • 5
    This is very helpful May 30, 2022 at 18:59
  • 3
    I think on my macOS 12.5.1 (Monterey) that directory is /System/Volumes/Data/.Spotlight-V100 Aug 31, 2022 at 16:04
  • 3
    @iamcrypticcoder all that "over 100%" means on unix-like systems is that more than 1 CPU core is used in total. Good software absolutely should go over that limit when necessary. For example, FFMPEG uses around 800% CPU on my quadcore/hyperthreading machine when encoding a video, and that’s a GOOD thing. Sep 13, 2022 at 9:54
  • 3
    @FlorianWendelborn it's a good thing for a non background process
    – m8labs
    Mar 8, 2023 at 15:30
119

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
    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
  1. add those directories to the exclusion list in System Preferences → Spotlight → Privacy
17
  • 14
    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, 2020 at 11:09
  • 14
    In any open dialog hit cmd-shift-dot to show hidden files , and Library will be shown Jun 30, 2020 at 15:59
  • 1
    It is unclear to me how this is helpful... should I just assume that anything which is output from this command often is something that I should remove from indexing? If so, are you passing the results of this command to a text file and then doing some cut, uniq -c, etc. magic? Please elaborate. Thanks! Aug 14, 2020 at 15:19
  • 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, 2020 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, 2020 at 20:21
25

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.

19

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.

5
  • 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, 2020 at 23:32
  • yea how ll you make this work on osx 11.4
    – PirateApp
    Jun 13, 2021 at 8:59
  • 5
    TIL (from support.apple.com/en-gb/guide/mac-help/mchlp2811/mac ): "If you exclude a Time Machine backup disk, you continue to receive messages that Spotlight is indexing it. This indexing is necessary for Time Machine to function properly and can’t be disabled. Spotlight does exclude from searches items stored on the backup disk that are not part of a Time Machine backup." Nov 5, 2021 at 10:59
  • Remember that Time Machine backups that are on a networked disk like a Time Capsule actually use a sparsebundle disk image. Contrary to other disk images this is actually really a bundle, i.e. a directory. And Spotlight will happily index it. The bundle will show up as a disk image icon in the Finder; if dragging that onto the exclusion/Privacy list doesn't work you can use the [+] button, type / into the file dialog, enter the sparsebundle path in the widget that appears. I couldn't select the directory at that path itself, but could add the Bands subdir which contains all data.
    – RJVB
    Feb 12, 2023 at 21:11
  • So, if my TM backup resides in a sparsebundle called TM on a networked volume called Backup, I click [+] under the Privacy list, hit / in the file dialog and point the dialog to /Volumes/Backup/TM.sparsebundle by entering that text. Then, select the Bands folder and click [Choose].
    – RJVB
    Feb 12, 2023 at 21:15
10

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

9

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
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
5

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!
4

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...

1
  • FYI: While this will prevent files from these directories from appearing in spotlight results it does not prevent mds_stores from scanning the directories, unfortunately. You can verify this yourself by adding a directory to the privacy tab and then, in terminal or Finder, copy files around while running "sudo fs_usage -w -f filesys mds_stores" (as in AnthonyMetzidis's answer) -- you'll see activity. I mention this only because this fact is buried a bit in the replies to the answer. Jun 27, 2022 at 16:24
1

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.

3
  • 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, 2016 at 4:25
  • 3
    Yes, this is actually quite bad advice. Anything you don't want scanned should be in Privacy. Jan 26, 2017 at 17:16
  • It's actually a mix. I understand his confusion. In the Search Results tab, we need to select less categories to include. in the Privacy tab, we need to add more for exclusion. Sep 7, 2022 at 2:38

You must log in to answer this question.

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