Disable Spotlight Index on 10.8 on Specific Volumes

To switch off indexing in Terminal I use:

sudo mdutil -a -i off

This disables it with the -a switch across all volumes and the -i off part turns "off" the indexing.

If connected to my iMac is the following volumes:

/Volumes
  /MacintoshHD
  /BOOTCAMP
  /NAS6TB

How do I specifically turn off the indexing service only for /BOOTCAMP and /NAS6TB? I tried following the instructions in the man page, but they weren't very clear.


Solution 1:

From terminal type:

sudo mdutil -i off [mountpoint]

If you need to remove the index cache of a network drive that has been stored locally, then use the -p flag. Likewise, to remove the local cache of a locally attached volume, use the -E flag.

If you want to delete from /BOOTCAMP then you would use:

sudo mdutil -Ei off "/Volumes/BOOTCAMP"

NOTE: Quotations around the mountpoint of the volume are unnecessary if there are no spaces in the volume name or mountpoint. Otherwise you would need to use an escape character \ before each space.

e.g. sudo mdtuil -Ei off /Volumes/Macintosh\ HD for "Macintosh HD"

Solution 2:

Open spotlight preferences in System Preferences and drag each folder to be excluded into the exclusion list.

Solution 3:

Spotlight is a powerful tool for searching results in few seconds. Still if you want to disable, it can be done using launchctl, with password:

sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist

Or, to switch off the indexing, you can follow this command

sudo mdutil -a -i off