How to Disable (or Enable) Spotlight in Mac OS X Mavericks & Mountain Lion
Completely disabling and reenabling Spotlight in Mac OS X Lion, OS X Mountain Lion, and OS X Mavericks can be done with the help of the Terminal. The following command unloads the Spotlight mds agent from launchd, thereby 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.
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.
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 quite 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. Don’t be surprised to discover that MDS, mdworker, and the accompanying Spotlight processes take up CPU and use a fair amount of disk I/O as they reindex the drive, that is completely normal especially on initial reindexing after it’s been reenabled again. Simply waiting for it to finish is the best course of action.
Another option is to selectively disable Spotlight indexing of specific drives or folders by excluding them from the index, that is much easier to do and does not involve the command line at all, and instead you only need to drag & drop items into the Spotlight control panel.
Use whichever method is most appropriate for your needs. Spotlight is a powerful search tool for the file system and also works great as an application launcher, so it’s often best to selectively exclude items rather than to disable the entire service. Nonetheless, there are cases where turning Spotlight off completely makes sense, and knowing it can easily reenabled by using the command discussed above makes the process easy to reverse should the need arrise.