How to Disable (or Enable) Spotlight in Mac 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.


Is there any performance improvements when spotlight is disabled?
^ 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)
any chance to get rid of the search/spotlight icon top/right?
Yeah there is
Open terminal and type
sudo chmod 600 /System/Library/CoreServices/Search.bundle/Contents/MacOS/Search
press enter (type your password in if you have to) and then type
killall SystemUIServer
Should be gone now !:)
worked, thanks for the help!
is there a way to index a connected network server?
Why would you want to do this?
I use Alfred instead and never use Spotlight so having it indexing my drives on connect and disconnect and once a week is annoying. Without a special use case, you wouldn’t want to do that though.
I am using quicksilver so spotlight isn’t needed.
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?
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.
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.
Or the Spotlight interface is connected to some phantom index.
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?
Store V1 and Store V2 are normal part of Spotlight, they’re just metadata cache
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.
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”.
If you on SSD, there is no point of doing this. Just for the performances.
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.
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.
[...] you are disabling Spotlight or just wanting to reduce menubar icon clutter, it’s possible to hide the Spotlight icon. [...]
[...] Via | OSXDaily [...]
[...] is a much better approach than disabling Spotlight if all you want to do is hide certain files from prying [...]