How to turn Spotlight off and on. Terminal Copy and Paste LION OS X 10.7

Disable Spotlight

The primary method is using launchctl, this will require the administrative password:
sudo launchctl unload -w /System/Library/LaunchDaemons/

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/

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.