17

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!

2
  • 1
    by rm -R ./Spotlight-V100/ , I guess you mean rm -R /.Spotlight-V100/
    – meduz
    Commented Nov 22, 2016 at 8:34
  • 1
    May be related: Spotlight re-indexing takes too long or doesn't work (has an answer). Posting this here, since people may stumble upon this post while looking for a solution for that problem. Commented Nov 7, 2018 at 23:15

2 Answers 2

10

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/

13
  • 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.
    Commented Sep 22, 2016 at 23:29
  • 2
    Drat... What if you try sudo pkill -9 mds
    – MacManager
    Commented Sep 22, 2016 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.
    Commented Sep 22, 2016 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
    Commented Sep 23, 2016 at 0:13
  • 4
    sudo pkill -9 mds solved it for me! You should add it to your answer. Commented Sep 19, 2017 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. ;-)
9
  • Did reinstalling and restoring from backup fix your spotlight search issues?
    – muhan
    Commented Nov 21, 2016 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
    Commented Nov 21, 2016 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.
    Commented Nov 21, 2016 at 14:40
  • Did you try installing Sierra without erasing the partition first?
    – Adam Rice
    Commented Jan 18, 2017 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.
    Commented Jan 18, 2017 at 20:39

You must log in to answer this question.

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