Skip to content

Fixing Corrupted Spotlight Indexes

One of the more interesting features of Mac OS X is its Spotlight – a system-wide metadata database (metadatabase?) that was obviously rushed out the door before it was completely baked.

For a couple weeks I haven’t been able to do full-text searches of my e-mail store – it just stopped working. I found in the Spotlight preferences, the hard drive was added to the ‘Privacy’ pane (not by me) and it couldn’t be removed. Looking at the actual files (/.Spotlight-V100/) the modification times were changing but the size of the database files never did. Nothing in the logs about it.

After several dead ends, I finally figured out that one just needs to remove all the Spotlight files and reboot. One nice advantage of the Spotlight architecture is this is non-destructive – everything will be re-built automatically. One disadvantage is everything has to be re-built automatically, so it’s resource intensive. Anyhow, the exercise distills down to:

sudo mdutil -i off /
sudo mdutil -E /
sudo rm -rf /.Spotlight-V100/

Then restart the computer. This article from The X Lab is the most comprehensive, accurate, and intelligible reference to Spotlight workings I found on the ‘net.