Skip to content

August 10, 2011


Rebuilding Spotlight’s Index on OS X

After using the Alfred App for sometime I found it not indexing and searching properly. Alfred is a productivity application for Mac OS X, which aims to save you time in searching your local computer and the web.

Solution: rebuild the spotlight index. Downside: I turned it off. What’s going on behind the scenes is actually fairly trivial, and it’s possible to simply do everything via the command line in terminal.

The metadata utilities needs to run as root (sudo). To see what your drive is up to, enter:
sudo mdutil -s /

This will show the status on the root volume.

To turn indexing on for a volume, you enter:
sudo mdutil -i on /

Now you have to force Spotlight to rebuild its index by simply erasing the master copy of the metadata stores on the volume like this:
sudo mdutil -E /

However, while I did all this, Spotlight was still not building the indexed for me. Here’s how I solved it.

I wanted to check the date/timestamp on the Spotlight directory using:
sudo ls -la /.Spotlight*

While most of the files had the timestamp of when I tried to delete the index, not all the files had the current date and time. Additionally, the file sizes were not growing, a good sign the index was not being rebuilt.

Then, I did the following commands to make sure indexing was on, the spotlight metastore was really gone, and that I wanted it rebuilt. Enter each command seperatly:
sudo mdutil -i on /
rm -rf /.Spotlight*
sudo mdutil -E /

The moment I did the last command, this time the system came to life. The directory /.Spotlight-V100 was created, and the files inside it were growing quickly. Spotlight on the toolbar showed a progress bar, indicating the system would be done indexing in an estimated time.

Please follow these instructions at your own risk. The following step where enough to correct my problems and  I am using mac os x, 10.6.8

Reference Post: Walt-O-Matic
4 Comments Post a comment
  1. Jan 10 2012

    Thanks for this trick.
    Migrated a local account to an Active Directory account and lost my index. Called Apple, they couldn’t do anything…
    Found your page….i can see the index rebuilding now.

    Thanks again. You spared me a call to the Entreprise support (600 €)….

  2. David
    Nov 10 2012

    Thank you! You have a proper list of commands to get the job done!

  3. matt
    Sep 12 2013

    tried all this got to rm -rf /.Spotlight*
    and was given access denied.
    spotlight is still indexing to no avail. not a clue what to do. not a huge brainiac when it comes to the ins and outs of mac. been indexing for 2 weeks now and its pissing me off.

  4. Jose
    Oct 12 2013

    I’m Very Grateful Friend..

    I almost reloaded a whole new OS..arrrgh!!

    But This saved me HOURS and hours,,



Leave a comment

Note: HTML is allowed. Your email address will never be published.

Subscribe to comments


This site uses Akismet to reduce spam. Learn how your comment data is processed.