How to Disable (or Enable) Spotlight in Mac OS X Lion

Dec 10, 2011 - 27 Comments

Disable Spotlight in OS X Lion

Completely disabling and reenabling Spotlight in Mac OS X Lion can be done with the help of the Terminal. The following command unloads the Spotlight mds agent from launchd, preventing the daemon from running or indexing any drives entirely.

Open up the Terminal (found in /Applications/Utilities/) and enter the following commands based on the need to either disable or reenable Spotlight indexing. This will effect indexing on all drives connected to the Mac.

Disable Spotlight

The primary method is using launchctl, this will require the administrative password:
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist

Another approach is to use the older indexing method of “sudo mdutil -a -i off” which turns off indexing only, but more on that in a minute.

Reenable Spotlight

The guaranteed way to reenable Spotlight is to reload it into launchd using launchctl:
sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist

Again, the alternate approach is the indexing related “sudo mdutil -a -i on” command, but that method can throw the “Spotlight server is disabled” error and not allow you to turn it back on. If you run into that problem, use the sudo launchctl load command instead to enable both indexing and Spotlight.

With Spotlight reloaded launchd, the mds agent will immediately start running again to reindex the filesystem. Depending on the amount of changes and new files since the last time MDS ran, this can take a while. You can verify that MDS is running through Activity Monitor or by pulling down the Spotlight menu to see an “Indexing Drive Name” progress bar.

Enable Spotlight in OS X Lion

Related articles:

Posted by: AJ in Mac OS X, Tips & Tricks, Troubleshooting

27 Comments

» Comments RSS Feed

  1. John says:

    Is there any performance improvements when spotlight is disabled?

  2. cliff says:

    ^ any performance gains?
    Also, what are all those icons in your screenshots… man that’s a lot of apps you have running. (may grab a few, so let me know what they all are)

  3. Ovidiu says:

    any chance to get rid of the search/spotlight icon top/right?

  4. Gabe says:

    is there a way to index a connected network server?

  5. Sue Dunham says:

    Why would you want to do this?

  6. James Ludtke says:

    I know this is off the topic, but I have tried to get Spotlight to work in Lion, and I never succeeded.

    My problem is that spotlight finds items, which do not exist. If I search for a set of characters, which are almost certain not to exist on my computer, such as “h3%n9q”, Spotlight finds hundreds of files if searching by name or by content.

    I re-indexed Spotlight, disabled Spotlight, re-enabled Spotlight, deleted all cashes in Lion, deleted Spotlight preference file. Did this using Spotlight preference panel or Terminal.

    I once got Spotlight to work for about three days, then the same old problem was back.

    Anybody else has the “find-nonexisting-items” problem?

    • Will says:

      I’ve never heard of this issue, have you tried deleting all the preferences and caches? Do you have FileVault encryption enabled? If you’ve been upgrading from Mac OS X version to Mac OS X version, there could be some legacy preferences or otherwise corrupting Spotlights index and causing it to behave like that, the solution may be to backup and reinstall Lion, as annoying as that is.

      • James Ludtke says:

        Will, thanks for your suggestions.
        I do not use encryption. I did a clean install of Lion–I think because I installed over the internet as anybody else. I don’t remember if the Internet install gave me a clean install option. I always used a clean install for new systems installed from a DVD.

        A wile ago I set my normal HD to be excluded, and set my backup HD for search. After indexing was complete, I had the same problem. Confirming the problem is not caused by a faulty HD. I will use another HD just to be certain, just in case the bug got copied to the backup drive.

        Then I tried something else. I searched Spotlight using the terminal, e.g. mdfind h3%n9q. Works OK, no files found. Also finds files with valid search input.

        I guess this means the Spotlight database is OK, and the problem is in the Spotlight interface. Strange! BTW, I get the same bad Spotlight results in searches from a window as I do searching from the Spotlight menu.

        • James Ludtke says:

          Or the Spotlight interface is connected to some phantom index.

          • James Ludtke says:

            Following up on the last idea, I did a terminal ls.
            MacPro:~ Udo$ sudo du -m /.Spotlight-V100 produced this:
            570 /.Spotlight-V100/Store-V1/Stores/308A3197-7E1D-45CE-B998-6E40C7C2CB9C
            31 /.Spotlight-V100/Store-V1/Stores/BEDA5A58-9744-4E2D-A693-24F43A3884E7
            601 /.Spotlight-V100/Store-V1/Stores
            601 /.Spotlight-V100/Store-V1
            4 /.Spotlight-V100/Store-V2/7D6EA8C8-E0E8-4184-85F6-39EE2B5A52B2/Cache/0000/0000/000a
            7 /.Spotlight-V100/Store-V2/7D6EA8C8-E0E8-4184-85F6-39EE2B5A52B2/Cache/0000/0000/000b

            45 /.Spotlight-V100/Store-V2/7D6EA8C8-E0E8-4184-85F6-39EE2B5A52B2/Cache/0000
            45 /.Spotlight-V100/Store-V2/7D6EA8C8-E0E8-4184-85F6-39EE2B5A52B2/Cache
            1 /.Spotlight-V100/Store-V2/7D6EA8C8-E0E8-4184-85F6-39EE2B5A52B2/journals.live
            0 /.Spotlight-V100/Store-V2/7D6EA8C8-E0E8-4184-85F6-39EE2B5A52B2/journals.repair
            0 /.Spotlight-V100/Store-V2/7D6EA8C8-E0E8-4184-85F6-39EE2B5A52B2/journals.scan
            1049 /.Spotlight-V100/Store-V2/7D6EA8C8-E0E8-4184-85F6-39EE2B5A52B2
            1049 /.Spotlight-V100/Store-V2
            1649 /.Spotlight-V100

            Is this typical? What is Store V1 and Store V2?

          • MW says:

            Store V1 and Store V2 are normal part of Spotlight, they’re just metadata cache

        • James Ludtke says:

          I did try another HD, which contains only data files (no system installed). Spotlight works Ok. So, the problem is caused by something on the HD, which contains the system.

          • James Ludtke says:

            Finally solved the problem.
            I had run Apple disk repair before, and it had not fixed the problem. Running it today (OS X 10.7.2) it fixed the Spotlight problem. Message was: “Updated boot support partitions for the volume as required”.

  7. Kevin says:

    If you on SSD, there is no point of doing this. Just for the performances.

  8. Neena says:

    It is amazing how customizable OS X really is.

    I have not needed to disable Spotlight for any reason. I would like to know why people might want to do this.

    That being said – it is good to know that it can be done.

  9. Juan says:

    I have a suggestion for the article:

    You should mention that this will disable spotlight ACROSS the OS (using the search tool in a finder window won’t turn any results). Even if I am an avid Alfred user, I think that the search tool in finder windows is pretty helpful so I had to rush and re-enable spotlight to get that functionality back.

    Alternatively, if you just want to remove the spotlight icon you can open terminal and type :

    sudo chmod 600 /System/Library/CoreServices/Search.bundle/Contents/MacOS/Search

    and then type

    killall SystemUIServer

    This will effectively remove the spotlight icon from the menu bar, yet you’ll keep the functionality.

  10. [...] you are disabling Spotlight or just wanting to reduce menubar icon clutter, it’s possible to hide the Spotlight icon. [...]

  11. [...] is a much better approach than disabling Spotlight if all you want to do is hide certain files from prying [...]

  12. [...] that easy to do otherwise). There are a couple of terminal commands which will kill the function. How to Disable (or Enable) Spotlight in Mac OS X Lion It's a lot to type, but it worked. The alternate command is as follows: sudo mdutil -a -i off of [...]

  13. Adrian says:

    I try your code today on lion. But with error on launchctl. Any suggestion?

  14. [...] How to Disable (or Enable) Spotlight in Mac OS X Lion [...]

  15. Isidoros Sklivanos says:

    my sad had better performance specially when running intensive apps like final cut pro with indexing disable

Leave a Reply

 

Shop for Apple & Mac Deals on Amazon.com

Subscribe to OSXDaily

Subscribe to RSS Subscribe to Twitter Feed Follow on Facebook Subscribe to eMail Updates

Shared on Facebook

Shop at Amazon

Ad

OSXDaily on Facebook