Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

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

share|improve this question
    
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? –  cksum 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

7 Answers 7

up vote 15 down vote accepted

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.

share|improve this answer
    
I had this same problem after imaging. This solution worked for me :)! More than a year later. –  Ethabelle Aug 23 '12 at 17:35
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
share|improve this answer
    
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
    
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
    
@lemonginger: Step 2,rm -rf /.Spotlight*, fails with "permission denied". I'm stuck. –  raxacoricofallapatorius 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. –  raxacoricofallapatorius Oct 27 '11 at 21:13

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

share|improve this answer

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!

share|improve this answer

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).

share|improve this answer

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)

share|improve this answer
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
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.