40

Lion keeps "losing track" of Spotlight information. Directories and Applications disappear, full text searches stop working, etc. I seem to need to re-index it once a week or so.

However, now it appears to not work at all.

Running

sudo mdutil -i on /

from the Terminal I get a message

"Indexing and searching disabled."

I have tried trashing preference files, deleting the whole V100 folder, repairing permssions, etc but Spotlight still thinks indexing is turned off on my entire Volume (Yes have added/deleted whole disk from Spotlight's privacy preferences").

In the console I have quite a few errors that look like this

mds: (Error) Server: Disabled store registered for scope "/Applications"

However, I do not know how to tell it to re-enable that scope as mdutil gives an error when I try to turn on indexing and gives an error when I try to delete the index

EDIT: I reinstalled Lion. It did not fix the problem(s) :(

8
  • Are you using some "cleanup" tool by chance? Some of them are overly aggressive and delete the spotlight index. Commented Sep 7, 2011 at 17:38
  • nope, no cleanup tools. Commented Sep 7, 2011 at 17:41
  • You could try flushing your cache and rebuilt it with the following command: sudo mdutil -pEsav. The command you are running just turns it on, but it may be chocking for a different reason. How much space do you have free on the drive (how much taken)? And what are the errors you receive from mdutil?
    – user10355
    Commented Sep 7, 2011 at 20:35
  • I second running sudo mdutil -pEsav. My timemachien drive was constantly being indexed. After running that and waiting for spotlight to finish the rebuild I had no more problems.
    – cftarnas
    Commented Sep 7, 2011 at 20:41
  • As mentioned, that doesn't work because Spotlight thinks it is disabled. Running the above command gets me: Indexing and searching disabled. Error: datastore publishing not implemented. Commented Sep 7, 2011 at 21:27

10 Answers 10

35

I had the exact same problem, with all solutions above failing identically. Then I reexamined the directory listing for / and found a hidden file .metadata_never_index in the root directory. I removed this file and was able to turn spotlight on again with mdutil -i on /.

mds is now reindexing the hard disk, all looks good for now.

4
  • I had this same problem after imaging. This solution worked for me :)! More than a year later.
    – Ethabelle
    Commented Aug 23, 2012 at 17:35
  • THANK YOU! Been trying to get this to work for a couple months on work laptop. I did sudo rm .metadata_never_index, then ran your mdutil -i on / and it said "Indexing enabled." Now I finally get the indexing graph!
    – neoscribe
    Commented Feb 7, 2015 at 0:52
  • This fixed it for me as well, however the issue comes up again after I rebooted. The .metadata_never_index file reappeared in /. However, it's possible that the reason is I simply ran the command sudo mdutil -a -i on (without specifying `` at the end).
    – mrk2010
    Commented Mar 7, 2017 at 18:07
  • 1
    This solution worked for me on a fresh install of macOS Sierra 10.12.6, December 2017
    – lacy
    Commented Dec 4, 2017 at 19:43
29
sudo mdutil -i off /
sudo rm -rf /.Spotlight*
sudo mdutil -i on /
sudo mdutil -E /

1 - turn indexing off

2 - delete Spotlight folder

3 - turn indexing on

4 - rebuild

Does this help?

Also it seems you could use these commands:

sudo mdutil -a -i off
sudo mdutil -a -i on
8
  • No, when I try that on any Volume or subset of a Volume I get the following, as mentioned Indexing and searching disabled. Commented Sep 7, 2011 at 21:28
  • 1
    I know it has something to do with the MDS error messages in the log (mds: (Error) Server: Disabled store registered for scope XXXX) but I don't know why/how those are disabled Commented Sep 7, 2011 at 21:29
  • 1
    @lemonginger: Step 2,rm -rf /.Spotlight*, fails with "permission denied". I'm stuck.
    – orome
    Commented Oct 27, 2011 at 2:34
  • Try with sudo rm , I edited my above post
    – maggix
    Commented Oct 27, 2011 at 7:07
  • @maggix: I'd tried that too (good suggestion), but it also fails.
    – orome
    Commented Oct 27, 2011 at 21:13
11

The other solutions didn't work for me, however the following was the culprit in my case.

Make sure your root/main hard drive isn't in the "privacy" settings for spotlight. For some reason I had the whole hard drive under the "Prevent spotlight from indexing the following locations" list.

You can access this section from System Preferences -> Spotlight -> Privacy

4
  • This was the key for me. The volume I wanted to index was in the Privacy window. Clicking minus (-) removed it. Then I could apply the steps outlined by maggix. I had to 'enable' twice, once for searching, and then for indexing. Same command both times: sudo mdutil -i on /
    – Dickster
    Commented Nov 20, 2017 at 19:37
  • WARNING: I have a two-system hard-disk divided into two Volumes. When I add the volume I'm NOT using to the Spotlight -> Privacy panel, I discover it appears in the OTHER Volume's Privacy panel as well. So when I restart onto the OTHER Volume, it's in its own Privacy panel?!! NOT what I expected, especially since each Volume has its own .Spotlight-V100 directory. Is this an Apple bug?
    – Dickster
    Commented Nov 20, 2017 at 20:36
  • This solved the issue for me! :) Thanks! :) Commented Apr 16, 2020 at 6:41
  • The unique solution that works for me! Thank you so much!!
    – PRVS
    Commented Dec 5, 2020 at 10:12
6
sudo mdutil -i off /
sudo rm -rf /.Spotlight*
sudo rm -rf /.metadata_never_index
sudo mdutil -i on /
sudo mdutil -E /

A combination of the above worked for me. Step 3 was the big one. Got rid of the "Indexing and searching disabled." message. Then steps 4 and 5 worked as expected.

  1. turn indexing off
  2. delete Spotlight folder
  3. delete metadata file
  4. turn indexing on
  5. rebuild
1
  • this worked for me.
    – dirkk0
    Commented Jun 28, 2017 at 21:24
4

After all of the initial troubleshooting steps:

  • Rebuild the index
  • Attempt in another user account
  • Dump prefs/cache and start over

I found the issue lied in what was enabled/disabled. In terminal, I ran "mdutil -sa" and got:

/:
    Indexing enabled. 
/Groups:
    Indexing disabled. 
/Shared Items/Public:
    Indexing disabled.
/Users:
    Indexing disabled. 
/Users/sarah/Documents:
    Indexing enabled. 

I noticed "/Users: Indexing disabled." That's the problem there. The fix: "sudo mdutil -i on /Users". After that, it re-indexed /Users, which took significantly longer than it had before, and before it was finished, it was searching my Mail!

3

This can also be caused by getting stuck in safe mode. To fix that, you need to reset the NVRAM by holding down the Command ⌘, Option ⌥, P, and R keys immediately after rebooting (before the gray screen appears).

1

I noticed this issue after my iMac installed the software update 10.7.4 to my machine. Most of the suggested command-lines would produce 'Indexing and searching disabled'. sudo mdutil -pEsav gave me 'datastore publishing not implemented.'

Below is the solution that worked:

  • edit /etc/hostconfig
  • add the line 
SPOTLIGHT=-YES- at the bottom (this line was missing)
  • reboot

(after reboot make some soup while your machine prepares the index)

1
  • this file no longer exists in 2024 on macOS 14. I like the idea of it, but don't know if it's compatible anymore.
    – John
    Commented Sep 8 at 22:59
1

Only the combination of -E and -i on worked for me:

sudo mdutil -E -i on /Volumes/blah
0

This worked for me: Re-enable Spotlight Indexing

sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist
1
  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes.
    – grg
    Commented Aug 17, 2017 at 9:13
0

I've tried for days about every solution out there for Big Sur, and the combination of these steps seemed to solve it for me. Trust me I didn't want do disable system integrity either but it's the only thing that worked:

  1. Disable system integrity (restart -> hold cmd + r -> select utilities terminal -> csrutil disable -> restart again)
  2. run
sudo rm /System/Volumes/Data/.metadata_never_index
  1. run
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist
  1. run
sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist
  1. Reenable system integrity csrutil enable following steps in step #1

Specifically the problem I had was I could not search applications. As you can see in the image, I can now see the application and it will successfully open it. Also, notice the index loading indicator:

enter image description here

You must log in to answer this question.

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