How to fix Spotlight when it keeps indexing in Mac OS X Lion

Today I noticed that the fan of my MacBook was continuously spinning because my Spotlight kept indexing for hours. Even when it was finished, a couple moments later it started reindexing again. After searching Google for a while finding no working solutions, I finally found one that worked for me.

Spotlight keeps indexing – the fix

If you execute the following command in your Terminal (Applications/Utilities) Spotlight should stop indexing (N.B. make sure you copy it exactly.):

sudo rm -rf /.Spotlight-V100/*

Re-index Spotlight

The above command deletes your current corrupted index. Now execute the following command to force a re-index of Spotlight for one-time(If it gives you a -400 error, rebooting and trying again should work). After running the command, Spotlight should start re-indexing within a minute.

sudo mdutil -i on -E /

Please note: It might seem that the problem hasn’t been solved, but the second command tells Spotlight to do a real, proper reindex. If everything is okay, it doesn’t reindex indefinitely now, but should be done in a couple of hours.

This is not a permanent solution, as the problem happened to me twice in the last eight months. So if your Spotlight keeps indexing too, please do let me know it it worked for you, and if you have any other solutions or know the root cause of this problem.

26 thoughts on “How to fix Spotlight when it keeps indexing in Mac OS X Lion

  1. Hi,
    I am having a problem with Indexing on my Mac. It is causing the whole system to run very slowly (I think!) and will not stop.
    I tried using:

    sudo rm -rf /.Spotlight-V100/*

    in the terminal window as you recommended although this did not stop the problem. When I used the second command it stated ‘Indexing enabled’.

    Any ideas why this is not stopping the indexing in the first place?

    Thanks,
    Jamie

    • Hey Jamie,

      The second command tells spotlight to reindex the system which it will then do. So it seems the problem isn’t fixed at first (as it still is indexing), but (at least for me) it now properly indexes just once and was finished in about an hour or so.

      Hope this helps,
      Guido

  2. Do you copy and paste the number 1 and the vertical bar, or just the part that starts with sudo?

    I’m leery about the terminal.

    • No you don’t copy those, so just:

      sudo rm -rf /.Spotlight-V100/*

      and

      sudo mdutil -i on -E /

      Hope this helps.

        • Spotlight to start reindexing is normal, however 4 days is way too long. I am sorry, it is hard to help from here. What does Terminal say when you execute both commands?

          Edit: I also see that since the 10.7.5 update a lot of people have a problem with Spotlight. It might be that the root cause of that problem is not the same as the root cause of the earlier problem. Therefore, the proposed method might not work in that case.

          Please check https://discussions.apple.com/thread/4271843?start=15&tstart=0 if you got this problem since/because of the 10.7.5 upgrade for more info.

  3. Guido,
    Vraagje:
    Have the same forever indexing issue. Copy/pasted the first command in terminal. It then asks me to enter my password but I can’t seem to type nothing nor can I copy paste my password in terminal.

    Tried re-starting but same as above.

    Do you have any ideas on how to fix this ….

    Hope to hear from you soon.

    Groeten uit Amsterdam

    • Hey Daan,

      First of all, did you make sure you only copied the command? So without the “1|”, as Rick had a problem with above?

      Secondly, when it asks you for your password, it might seem that you are not typing but that is just Terminal hiding your password for people that might be watching at your screen along with you.

      So, if you type your password and hit enter, what does it say?

  4. Password is hidden, I didn’t know that. Just read this string here: https://discussions.apple.com/thread/4271843?start=15&tstart=0

    It’s a bit to tech savvy for me to fully understand.

    Still have same issue: This is what I did in terminal

    Last login: Mon Oct 1 23:31:51 on console
    mac-dc-verhorst:~ DanielSan$ sudo rm -rf /.Spotlight-V100/*

    WARNING: Improper use of the sudo command could lead to data loss
    or the deletion of important system files. Please double-check your
    typing when using sudo. Type “man sudo” for more information.

    To proceed, enter your password, or type Ctrl-C to abort.

    Password:
    mac-dc-verhorst:~ DanielSan$ sudo mdutil -i on -E /
    /:
    Indexing enabled.
    mac-dc-verhorst:~ DanielSan$

    ——

    Bummer, should I try again?
    Thnx

    • It seems like the commands did work properly.

      The last command however, tells Spotlight to make a proper re-index (after you deleted the index with the first command). This means that indeed, Spotlight will start indexing again.

      Different than before however, if everything is okay, it should not reindex indefinitely now, but be done in a couple of hours.

      So I suggest you let it running for a couple of hours, after having done those two commands. Did that work?

  5. Guido,

    This is a 10.7.5 problem and 10.8.2. I’m on 10.7.5.

    Lots of people seem to have this problem and Apple doesn’t react or say nothing. Most treats start around september 23th 2012

    • Ah, I had this problem earlier this year running Mac OS X 10.7.3. The recent 10.7.5 might be the cause of a lot of the problems you describe are appearing everywhere.

      I can’t test whether it works on 10.7.5 and/or 10.8.2 for sure, however, even in the last few days, the method proposed above has worked for some people running those systems.

  6. First of all, many thanks, it worked!

    But, the main question is that the preferences of spotlight doesnt work, just report an error… Do you please have any solution for that ?

    best regards.

    • Glad to have been of help!

      Could you elaborate on your problem? What error are you getting and when?

  7. Hi Guido,

    I tried entering the commands into the terminal and noticed nothing had really changed with my spotlight so i restarted my iMac and when it opened back up i was missing a lot of applications and files. Is there a way to recover them?? my back up also screwed up so i dont have one. Im not super tech savvy with these types of problems. Im running 10.8.4.

    Please HELP

    Thanks.

  8. I tried the sudo commands, but Spotlight still froze (then the beachball, then my whole computer) after 3-4 minutes. All long syncs freeze after 3-4 minutes: Timemachine, SuperDuper, and music files to my iPhone 5 in iTunes too.
    I have this problem for over a month now. Even had Mac techies check my MacBook Pro (all OK): they are baffled too.
    I reloaded Mac OS 10.7 and had a clean install of all my software. All my software. OS and iOS are up-to-date.
    No matter what I did: the problems remain.
    Any ideas/solutions?

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>