How to disable Spotlight and mds_stores on Mac OS Catalina

catalinadisk-spacespotlight

EDIT: I appear to have a temporary fix using mdutil – see the end of the post – but I am not sure if it is a permanent fix, so I am still interested in answers.

I have an iMac running Mac OS 10.15.4 (Catalina). My problem is that every few minutes, /System/Library/Frameworks/CoreServices.framework/Frameworks/Metadata.framework/Versions/A/Support/mds_stores starts up, and keeps going until my hard drive is full, and then seems to give up and give me my disk space back. (I believe it is not a "disk" now, but I will stick with the terminology). Not only does it make my disk full at unpredictable times, it also uses a lot of memory.

mds_stores appears to be the indexing program used by Spotlight; I am happy to disable both. I never use Spotlight.

I have followed the suggestions at https://www.technipages.com/macos-sierra-enable-disable-spotlight , i.e. disable System Integrity Protection, run

sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist

and then re-enable System Integrity Protection. But it does not work. It does not appear to have disabled Spotlight (I can still see a magnifying glass icon in the top right corner of my status bar) and it certainly does not stop my real problem: mds_stores running and filling up my disk.

I have also seen it suggested that I remove the index files via:

sudo rm -rf /.Spotlight-V100/*

However on this version of Mac OS (10.15.4, Catalina), there is no directory /.Spotlight-V100

20-Apr-20,15:26:46 ~> sudo ls -a /
Password:
.           .VolumeIcon.icns    .vol            System          bin         etc         private         usr
..          .file           Applications        Users           cores           home            sbin            var
.DS_Store       .fseventsd      Library         Volumes         dev         opt         tmp

I have also see the suggestion (at http://itechinspector.com/mds_stores-process-consuming-high-cpu-usage.html and also at https://discussions.apple.com/thread/8658455 ) to run sudo mdutil -a -i off . When I originally posted this was not working, but when I tried later in the day it did work:

20-Apr-20,21:35:27 ~> sudo mdutil -a -i off
Password:
/:
2020-04-20 21:35:40.665 mdutil[8406:156351] mdutil disabling Spotlight: / -> kMDConfigSearchLevelFSSearchOnly
    Indexing disabled.
/System/Volumes/Data:
2020-04-20 21:35:40.778 mdutil[8406:156351] mdutil disabling Spotlight: /System/Volumes/Data -> kMDConfigSearchLevelFSSearchOnly
    Indexing disabled.

[It also gave me back a ton of disk space. I was sitting at 27 Gi free, which mds_stores would gradually gobble up. After running the above command, I suddenly have 55 Gi free; so I got back 28 Gi, more than 10% of my disk!]

So I appear to have a temporary fix, which I assume will go away next time I reboot. Does anyone know if that (or something else) disables Spotlight and mds_stores, permanently, for Catalina? (Because it looks like it might work a little differently to earlier Mac OS versions).

Best Answer

In my experience, a failing disk and/or a disk filesystem that’s damaged or failing is the cause for most spotlight processes that run too long. Also, metadata importers that are added by programs like Office and others run to index their files and can cause issues.

Before you disable this entirely, have you opened the spotlight settings and added each user home folder to the privacy? This cleans all records of those user files from the database. Then you would restart the machine and perhaps boot to recovery HD and run Disk Utility to repair the disk.

Sometimes a clean install is all that’s needed - https://apple.stackexchange.com/a/66690/5472

Clearly, spotlight needs to take one pass over all the data, but then it should quit. As you say, if you don’t need it, adding the folders you wish to not have indexed is the easy way to let the system index things it needs, but ignore your user files, database files and other things that might cause temporary or permanent resource usage. I could see some high transaction data based never getting indexed if they don’t tell spotlight to not index files.