14

Config: Late-2013 rMBP running 10.12 (16A323)

Issue: Spotlight appears to be mostly non-functional since upgrading to Sierra. I originally noticed it when searches failed to bring up anything in Mail, and Spotlight itself will only surface results from Dictionary.

What I've Tried:

  1. Add my primary HDD to the Privacy exclusion list in Spotlight preferences (this resulted in a weird (null) error). The idea is adding, then removing will force a reindex.
  2. Run mdutil -sv / to find out what's up, resulting in "Error: unexpected indexing state. kMDConfigSearchLevelTransitioning".
  3. Run sudo mdutil -E / to delete and rebuild the index, resulting in "Error: Index is already changing state. Please try again in a moment."
  4. Run
    sudo su
    launchctl unload -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist
    rm -R ./Spotlight-V100/
    launchctl load -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist
    mdutil -E /
    this all works, and I get a brief pause after the last command before it spits out "Indexing enabled." Subsequent attempts at running mdutil -sv / spits out the aforementioned error as cited in #2 above.

Activity Monitor is showing that mds and several mdworker processes are churning most of the CPU cycles (and the fan is fairly vocal), which would imply that it's in the process of reindexing - yet the two ways I'm aware of confirming indexing behavior is not indicating that's the case:

  1. mdutil -sv / is returning that error.
  2. Doing a Spotlight search for anything (or "indexing" specifically) does not show any indexing progress bar.

So… is Spotlight either:

A. Actually indexing, despite both known ways of confirmation indicating it isn't? And, if so, citation(s) on that being the case / when can I expect it to be showing that it is indexing?

B. Actually borked? And, if so, any other ways I can try to resolve absent nuking the partition, doing a fresh install, and restoring from Time Machine?

Thanks in advance!

7

Did you reboot after #4 above? I think that should work... If not this may help:

sudo touch /.metadata-never-index

Reboot...

sudo rm /.Spotlight-V100/VolumeConfiguration.plist
sudo rm /.metadata-never-index

And reboot again. You can try this for every volume.

See also: http://www.filetypehelp.com/purpose-files-metadataneverindex-file-extension/

  • I was ~89% sure I had rebooted after doing #4 at least once, so I did it again and no change. Tried your alternative, but still getting the “unexpected indexing state” error when running sudo mdutil -sv / after the second reboot. – Brian M. Sep 22 '16 at 23:29
  • 2
    Drat... What if you try sudo pkill -9 mds – MacManager Sep 22 '16 at 23:44
  • Running the pkill then checking the status using mdutil results once again with “Indexing enabled.” Spotlight search for “a” does yield a couple things in addition to the Dictionary meaning, but absolutely nothing comes up when searching in Mail. Running mdutil -sv / a second time brings back the error - and subsequent Spotlight searches goes back to only yielding Dictionary results. So it does appear that when mds is active is causing this “unexpected indexing state” and preventing any results outside of Dictionary entries. – Brian M. Sep 22 '16 at 23:57
  • Hmmm... Other than killing it again and letting it index for a while (overnight?) I'm not sure what to try next. Sorry. – MacManager Sep 23 '16 at 0:13
  • 3
    sudo pkill -9 mds solved it for me! You should add it to your answer. – Brian McCutchon Sep 19 '17 at 5:40
2

After leaving my Mac alone for the weekend, my fears were confirmed and there was never any change to this Spotlight issue. Given the other threads here and elsewhere, it appears that Sierra has some challenges when doing an in-place upgrade.

Resolution:

  1. Confirm you are fully backed up (multiple backups preferred). THIS IS THE MOST IMPORTANT STEP!
  2. Reboot into Recovery Mode (hold down Command-R while Mac begins to boot).
  3. Open "Disk Utility" and erase the macOS partition (You did confirm those backup(s), right?).
  4. Once HD is erased, exit out of "Disk Utility", open "Install macOS Sierra" and install Sierra from scratch.
  5. After install completes, restore from backup.
  6. Get back to your life. ;-)
  • Did reinstalling and restoring from backup fix your spotlight search issues? – muhan Nov 21 '16 at 6:48
  • When you say restore from backup, do you mean a time machine backup? Wouldn't that kind of restore also bring back the spotlight problems? – muhan Nov 21 '16 at 6:58
  • @muhan As noted in this answer that I accepted, restoring from back up did resolve the issue. And to clarify, yes, it was a Time Machine backup that I used. – Brian M. Nov 21 '16 at 14:40
  • Did you try installing Sierra without erasing the partition first? – Adam Rice Jan 18 '17 at 19:56
  • @AdamRice No, I did not. This was my main machine and I didn't have the further patience to do that. There's obviously no way now to know, but I'm not inclined to think that just doing the install over again the corrupted instance would've made a difference. – Brian M. Jan 18 '17 at 20:39

You must log in to answer this question.

protected by Community Sep 25 '16 at 19:31

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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