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 SpotlightThe primary method is using launchctl, this will require the administrative password:
sudo launchctl unload -w /System/Library/LaunchDaemons/com..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.
Re-enable SpotlightThe 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 or by pulling down the Spotlight menu to see an “Indexing Drive Name” progress bar.