1. Home
  2. Mac OS X
  3. Fix spotlight search not working macos

How to fix Spotlight search not working on macOS

Spotlight search is possibly one of the best features on macOS. Operating systems all have a search feature but Spotlight is system search done perfectly. That said, it can break. It doesn’t happen often but sometimes, indexing problems may cause Spotlight search to stop working. This isn’t something a simple restart will fix. Instead, you need to reindex files to fix Spotlight search not working.

Fix Spotlight search not working

Open Terminal and run the following command.

sudo mdutil -a -i off

You will need to enter the admin password. Once you do, it will turn indexing off.

Next, run the following two commands;

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

If the above command doesn’t run and instead you get a message that it can’t complete because system integrity protection is engaged, you’re going to have to boot your Mac into Safe mode and turn system integrity protection off.

Once that’s done, run the command again and after it runs successfully, run the one below;

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

You can now enable Spotlight indexing again with the command below;

sudo mdutil -a -i on

Once indexing is enabled, Spotlight will start indexing everything on your Mac again. It may take some time for it to index everything which is why it won’t fix right away. Use your system normally and Spotlight will start working the way it should in a while.

This fix should stick. Spotlight is an old, refined feature and if it breaks there’s likely a specific reason behind it. The feature isn’t going to break at random like Windows search does on Windows 10. If Spotlight search does keep breaking and you need to reindex files every single time to fix it, the problem is likely something else.

After you’ve fixed Spotlight search not working, make sure you turn system integrity protection back on. This is a security feature that was introduced with El Capitan and it basically limits unrestricted root access to important files and folders thus preventing users, and malicious apps and/or processes, from making changes to critical files on the OS.

Quick fix

Enabling and disabling system integrity protection is a bit of a long process so if you aren’t up to it, and want a quicker fix, you can try simply running the first, and fourth commands in the previous section which disable and enable indexing. It may work, it may not work. If it fixes the problem then it’s all good. If not, you’re going to have to go with the full fix.

2 Comments

  1. All right, thanks for the tip! I’ve just tried the 1st and 4th command before I attempt the boot into Safe Mode, but I can say that something seemed nevertheless to work β€” because at least Spotlight will show an ‘Indexing’ bar when searching for a word. Previously, it did just make a perfunctory search and give an empty result set.

    When I tried to do a search in Finder β€” which would always display an empty window without giving any reason β€” at the beginning I was disappointed, because it didn’t show anything, even though I had done a partial search for a filename that was on the opened folder. But it started to write ‘Searching…’ and show the rotating progress icon, so I was curious (this didn’t happen before). And, indeed, after a minute or so, it spewed out a few results from that opened folder β€” for the first time in many, many months!

    Naturally enough, after a bit longer, it started to find partial matches on other filenames as well; it had found over 3000+ entries after five minutes. So far, of course, it’s still just giving out results from partial filename matches (Spotlight most certainly didn’t have the time to do full-text indexing of the whole disk), but since that’s what I need 90% of the time, I’m happy πŸ™‚

    Also, in some cases, Spotlight (invoked with ⌘-Spacebar) would show the odd Mail message or two. That’s very encouraging, since for eons I haven’t been able to do any searches in Mail β€” and I have around 500,000 messages (no joke!) stored from almost two decades and a myriad number of mailboxes. No matter how often I rebuilt the mailboxes, or deleted and recreated the index, I never managed to get Mail’s search working again. Now, at least, I get a ‘Searching…’ message back again, when trying to search across all messages… and after a minute or so, if had found 3200+ matches. That’s full-text search for sure!

    Oh, btw, while writing this comment, the folder search hit 7200+ items, and the last dozen or so were already full-text searches on RTF documents! So… yay! It is working!)

    Last but not least, I hit ⌘-Spacebar again β€” the first search I did when starting to type this comment was still there. Now, instead of a ‘generic’ progress bar (the kind that just bounces left and right), I get a real one, which shows that the total indexing process completed about 3% (it’s hard to gauge). But it already shows promising results: instead of the handful of entries, now it has several hundreds, and is certainly finding them in Mail (i.e. not only on the folders), and also started to (correctly) group results by document kind.

    Fantastic! And trust me, I tried many tools to get Spotlight working again, none of which produced any measurable results. It was just one of those things that I simply couldn’t rely upon any longer β€” for filename searches, I’m a keen user of the locate application on the command-line, and that works completely separately from Spotlight, so it has never stopped working (it’s just far, far more limited).

    Also, if you’re stuck with a ‘broken’ Spotlight, don’t worry: Apple’s Spotlight indexing is very efficient, in the sense that it will auto-adjust the amount of indexing in the background so as to minimise impact β€” and this is not just Apple’s marketing pitch, it really works that way, and works extremely well. So, if you’re doing intensive work, Spotlight will barely scratch your disk and remain peacefully asleep β€” because, well, we humans need to stand up to grab some more coffee, or go to the toilet, or eat something with our hands off the keyboard β€” which is more than enough for Spotlight to proceed with its work. The only main difference you might notice is a slight increase of battery consumption (and even that is not assured).

    In my case, I’m particularly interested if I can get Spotlight to ‘talk’ to my Synology NAS to use its search index as well. This is allegedly possible (or so Synology claims) but I never managed to try it out myself β€” Spotlight had stopped working well before I made any such attempts.

    I actually have a few clues about the why Spotlight stopped working. You see, beyond constant Spotlight searching, I also do remote backups β€” both via Time Machine as well as the Synology Drive remote sync facility. At some time in the past, I was doing many more β€” some folders via Dropbox, others via Google Drive, and so forth. I even used Pydio Cells for remote backups directly into a different geographic location! All these services eventually started to interfere with each other, to the point I had to overly simplify things: keep Time Machine, of course, and also backup the most important folders to the Synology NAS (so they could also be shared with others). The NAS, being a specialised device for file transfers in all possible directions as well as using all sorts of communication protocols, is then responsible for managing the many connections to the ‘outside world’ β€” it doesn’t care how many it establishes, it’s just a matter of properly keeping an insane number of indexes, all in sync, in real-time. But that means that macOS does not worry about that any longer.

    Unfortunately, when I made all these changes β€” as well as several experiments before I got them right! β€” it’s highly likely that I ‘broke’ Spotlight’s indexing ability at some point…

    Anyway, now that my remote syncing setup is pretty much stable, and, thanks to your article, I managed finally to get Spotlight working again, I’ll be back to more experiments β€” knowing that if Spotlight stops working again, now I have a way to get it working again!

    Thank you so very much!

  2. Spotlight is system search done perfectly.

    That is a matter of opinion… and I hope you are emotionally mature enough to tolerate the publication of dissenting opinions (since many Macintosh users and web sites are not.) So long as it works, Spotlight is good for locating your own documents… but the presentation is annoying to me, and the user interface cannot be customized. I still have to use other search tools like EasyFind or FindAnyFile for development and troubleshooting purposes (and I am omitting several others here which are more powerful, but do not run well on Apple Silicon, if they run at all.)

    That said, it can break. It doesn’t happen often

    Spotlight stops working every day here, even on the latest version of Mac OS with a brand new machine. It often happens randomly at some point after network shares are mounted or unmounted. I can restore functionality simply by quitting the ‘MDS’ process in Activity Manager, and reindexing is not required — but I should not have to teach grandma (and everyone in the office) how to use Activity Manager.

    Spotlight automatically indexes external drives without my consent, relays information to Apple, and searches the internet too. The former cannot be disabled by default, and the latter cannot be disabled at all. (Notice how you get a choice in Time Machine when you mount an external drive, but do not get the same choice where Spotlight is concerned.) In several cases where I attempted to rescue data from a corrupted external disk, Spotlight proceeded to corrupt the disk even more, without asking for permission to modify the file system. All of these issues have persisted for years through many editions of Spotlight and many generations of Mac OS.

    Nearly all of the complaints about system services freezing or excessive RAM & CPU load on Mac OS have involved processes which were “upgraded” by Apple to include background internet/iCloud functionality and “telemetry” that cannot be fully disabled despite what it says in System Preferences or the app user interface. All iCloud-enabled applications constantly log to disk and upload information to Apple in the background, even when no Apple ID exists on the machine. I wish that Apple would fix the bugs in the Mac OS user interface and various system services before they waste time implementing more cloud-based “features” like this:

    Spotlight is an essential component of my daily workflow and there is no excuse for the kind of reliability issues which this service has exhibited over the years. If Apple cannot address these ongoing problems, it demonstrates why the source code belongs in the public domain, where developers who possess the ability to fix bugs quickly & properly are permitted to do so. If that requires the removal of background network “features” which we don’t want or need, so be it.

    The feature isn’t going to break at random like Windows search does on Windows 10.

    I have not experienced this issue on Windows 10, but did find the performance of indexing and searching somewhat inferior there. As an alternative to the native search utility, I would recommend “Everything” from VoidTools (which utilizes system resources much more efficiently). I have not experienced any problems with that. But where I don’t need to run proprietary applications, I would prefer linux or BSD, because I dont have to battle some corporate monstrosity with its own agendas for control of my PC.

    I am also eagerly awaiting the official release of Google’s Fuchsia (a project which Apple abandoned as “too ambitious”) since it will be considerably more secure than Mac OS, and I can customize it however I please. We already have the betas running on desktops, and Linux is also being ported to Apple silicon as we speak. This may be heresy to the religious fanatics, but Mac OS is nowhere near “perfect”: it simply sucks less than Microsoft Windows, and the future is open source. The world cannot afford anything else — and I can’t afford to finance ego trips.