32

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) :(

  • Are you using some "cleanup" tool by chance? Some of them are overly aggressive and delete the spotlight index. – Ingmar Hupp Sep 7 '11 at 17:38
  • nope, no cleanup tools. – lemonginger Sep 7 '11 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 Sep 7 '11 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 Sep 7 '11 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. – lemonginger Sep 7 '11 at 21:27
32

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.

  • I had this same problem after imaging. This solution worked for me :)! More than a year later. – Ethabelle Aug 23 '12 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 Feb 7 '15 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 Mar 7 '17 at 18:07
  • This solution worked for me on a fresh install of macOS Sierra 10.12.6, December 2017 – lacy Dec 4 '17 at 19:43
22
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
  • No, when I try that on any Volume or subset of a Volume I get the following, as mentioned Indexing and searching disabled. – lemonginger Sep 7 '11 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 – lemonginger Sep 7 '11 at 21:29
  • 1
    @lemonginger: Step 2,rm -rf /.Spotlight*, fails with "permission denied". I'm stuck. – orome Oct 27 '11 at 2:34
  • Try with sudo rm , I edited my above post – maggix Oct 27 '11 at 7:07
  • @maggix: I'd tried that too (good suggestion), but it also fails. – orome Oct 27 '11 at 21:13
6

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

  • 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 Nov 20 '17 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 Nov 20 '17 at 20:36
4
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
  • this worked for me. – dirkk0 Jun 28 '17 at 21:24
3

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)

0

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

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

This worked for me: Re-enable Spotlight Indexing

sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist
  • 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 Aug 17 '17 at 9:13

You must log in to answer this question.

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