14

Setup

I've got a MacBook Air (13-inch, 2017)

Problem

When I type in the name of an application, Spotlight doesn't show the application. When I do sudo mdutil -E /, It says the following,

Error: unknown indexing state.

When I Select System Preferences, Click the Spotlight pane, select the Privacy tab and then click the Add (+) button and try to select anything, It says

Privacy List Error, the item couldn’t be added or removed because of an unknown error.

What I tried

I've tried https://www.macrumors.com/how-to/rebuild-spotlight-search-index-on-mac/, and Spotlight re-indexing takes too long or doesn't work. sudo rm -R .Spotlight-V100/ says

No such file or directory

sudo /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -seed -lint -r -f -v -dump -domain local -domain system -domain user -domain network

does a lot of stuff,

sudo rm -R .Spotlight-V100/ also says

Error: unknown indexing state.

sudo mdutil -E -i on / says

Error: unable to perform operation. (-400) Error: unknown indexing state.

How it happened

When I tried to download the macOS Catalina update, the mac got stuck in an endless loop of trying to update and then failing, forcing it into recovery mode, I tried to stop the update by using this link, https://www.mklibrary.com/technology/macos-sierra-stuck-endless-rebooting-loop/ but nothing worked, so I had to fully reinstall macOS, Spotlight now doesn't show any files or applications at all. It only shows other stuff like emails, Dictionary suggestions, etc.

(Note, I've also made sure to check all the categories in system preferences)

I've tried,

sudo mdutil -a -i off,

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

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

sudo mdutil -a -i on

It worked, however, it stopped working again afterwards when my computer shut down.

4
  • After re-setting the index, you need to leave it running for 'quite some time' before things can work properly. Also: have you checked that you disk is ok? A failing drive won't index.
    – benwiggy
    Sep 2, 2019 at 6:01
  • I've waited for a full day, and have used disk utility first aid and nothing seems to be wrong.
    – Sparky
    Sep 2, 2019 at 6:05
  • @ankiiiiiii Thanks, there's no progress bar at all,
    – Sparky
    Sep 2, 2019 at 7:32
  • I have exactly the same problem on my Mac mini with macos Mojave
    – John Xiao
    Nov 24, 2019 at 4:56

5 Answers 5

2

With all the deleting of files that spotlight depends on, I would write off that system entirely. Make a good backup - maybe two if you use Time Machine which may not have a good backup due to spotlight and the filesystem likely being suspect or corrupted.

Erase the entire volume and then test spotlight on a clean install. Once you are convinced the hardware is working with none of your old data or system present, you can erase again and migrate back your data or run Migration Assistant and/or migrate back by hand.

In the future, when you suspect a spotlight issue - I would run mddiagnose which dumps all the log files and data needed to determine the state, error, conditions of the spotlight / mds / metadata collection and indexing subsystems as well as system logs that can help show issues.

In most cases where we see this, it's corrupt data (bad spotlight importer crashing) as the system crawls all the data that causes things, so restarting that process doesn't fix the underlying issue. With all you've done, it's going to be very hard to find out the case but you could try working with Apple Support on a mddiagnose analysis or take a stab at reviewing it yourself.

3
  • "With all the deleting of files that spotlight depends on, I would write off that system entirely." the mac solution: blame the user. In an ideal world is would be possible to rebuild indexes or reinstall spotlight rather than the entire system.
    – Att Righ
    Mar 28 at 14:31
  • I could break most any system I wanted to. Doesn’t matter Mac or Windows or Unix with sudo and creativity. The reason I suggested an erase is this system no longer can update itself, and not that spotlight is a mess TBH @AttRigh - I certainly don’t blame people that want to learn and understand how things work, but this machine now has multiple symptoms and what if the hardware is the cause and it’s not even software?
    – bmike
    Mar 28 at 16:46
  • I guess. It certainly is possible to break a machine by messing with system files but I understand the assumption of "let's blow away the cache that'll fix it". Because this is often a good approach. I guess I've been spoiled for modularity in the linux world.
    – Att Righ
    Mar 28 at 20:10
7

I am not sure whether you have tried this step or not.

Open Terminal window from LaunchPad.

First, turn off Spotlight:

sudo mdutil -a -i off 

Next, unload the metadata file that controls Spotlight’s index:

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

Use the following command to re-loads the index :

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

As a last step, turn Spotlight back on:

sudo mdutil -a -i on 

After a few minutes to rebuild the index, Spotlight should be functioning as normal.

Let me know how it goes.

Update: I have a script for it and it is helping me in such kinds of issue.

#!/bin/bash
# This script is designed to fix Spotlight indexing issues
# by removing the existing Spotlight index and forcing Spotlight
# to create a new search index.

# Turn Spotlight indexing off

/usr/bin/mdutil -i off /

# Delete the Spotlight folder on the root level of the boot volume

/bin/rm -rf /.Spotlight*

# Turn Spotlight indexing on

/usr/bin/mdutil -i on /

# Force Spotlight re-indexing on the boot volume

/usr/bin/mdutil -E /

Save this as .sh and run from the terminal. It should help you to fix your issue too.

8
  • Doing sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist says Could not find specified service
    – Sparky
    Sep 3, 2019 at 10:07
  • It worked but, it stopped working again @Udhy
    – Sparky
    Oct 14, 2019 at 4:28
  • have you tried this step again ?
    – Udhy
    Oct 14, 2019 at 12:44
  • I have multiple times. It doesn't work anymore @Udhy
    – Sparky
    Oct 15, 2019 at 0:11
  • rebuilt the index using this in the Terminal: sudo mdutil -E -i on /
    – Udhy
    Oct 15, 2019 at 10:50
0

Go to system Preferences and click on Spotlight. This brings up a panel where you tell Spotlight where to search. Check that Applications is checked. See figure below.

enter image description here

1
  • That box has been checked the entire time,
    – Sparky
    Sep 3, 2019 at 4:10
0

For anyone whom it may concern: I ran into this problem on High Sierra. I tried everything including a system restore without luck. Finally I discovered that I had an extension running called Paragon NTFS. After removing this, things started to work again.

0

Solution which worked for me. I completely lost Spotlight function, tried so many suggestions to restore Spotlight indexing, to no avail. Until now. The process is: Close SystemUIServer "Start by simply resetting a particular process. This quick and easy step often solves spotlight related issues. First, launch Activity Monitor by opening Finder and going to the Applications folder. Then, go to Utilities and choose Activity Monitor. In the window, look for SystemUIServer in the list, or use a search field to find it quickly. Select this process and then click on the quit process button. When you close this process, the menu bar and dock will reload within a few moments - this is a sign that the process has been reset. Check if Spotlight issues are fixed."

This is taken from this link:https://blog.pcrisk.com/mac/12708-spotlight-search-not-working-on-mac-how-to-fix

Very simple, and Spotlight indexing immediately restored.

You must log in to answer this question.

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