OS X — When Spotlight Won't Reindex

Last updated May 16, 2009

[ I originally wrote this for Leopard; it may or may not still be applicable to later versions. ]

I went to search for something in Mail.app, and noticed that the option to search “Entire Message” was greyed out:

mail_no_search

Mail.app, at least in Leopard, uses Spotlight for message indexing and searching. To be honest, I never use Spotlight directly (using Quicksilver instead), so I’m not sure what other search functionality, if any, was broken at the time.

Normally one can force a rebuild of the Spotlight index via:

    $ sudo mdutil -E <path_to_volume>

but that wasn’t working for me. Neither was trying to reenable indexing:

    $ sudo mdutil -i on -E /
    /:
    Error: unable to perform operation. (-1)
            No index.
    $

To fix, I ran:

    $ sudo rm -r /.Spotlight-V109

to blow away the existing index, then:

    $ sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist
    $ sudo mdutil -i on -E /
    /:
            Indexing enabled.
    $

Clicking on the Spotlight icon in the upper right corner showed that it was now indexing. Once that finished, the “Entire Message” search came back to life.