Spotlight Cheat Sheet
Monday December 03rd 2007, 3:23 pm
Filed under: OS X / MacOS

Here are some useful commands for taming Spotlight, the powerful but often irritating content indexing tool introduced with OS X Tiger. These tips were taken from a Macintouch article by Robert Mohns.

1. Turn indexing on for a volume:
sudo mdutil -i on /Volumes/VolumeName

2. Turn indexing off for a volume:
sudo mdutil -i off /Volumes/VolumeName

3. Delete the index for a volume:
sudo mdutil -E /Volumes/VolumeName

4. Force a rebuild of the index for a volume (should happen automatically following a delete):
sudo mdimport -f /Volumes/VolumeName

5. Force a rebuild of the Mail.app index only:
mdimport -r /System/Library/Spotlight/Mail.mdimporter

Put the name of your target volume in place of VolumeName. If you’re running a command on the startup volume, you only need to use a forward slash (/).


There are two common scenarios where you’d want to use these commands.

1. Spotlight seems to start indexing at random. (This isn’t normal behavior.)
Delete the index for the startup volume; it’s probably corrupt. It should rebuild itself after:
sudo mdutil -E /

2. Spotlight insists on indexing external drives each time they’re mounted. (This is normal behavior, but it’s annoying.)
Using the command line, turn off indexing for each external drive:
sudo mdutil -i off /Volumes/VolumeName


If you’d just like to turn Spotlight off entirely, without having to type commands, you can use the Disable Tiger Features utility. Be warned that, while old-fashioned filename search still works without Spotlight, there are some odd side effects–for instance, you can no longer search for text in the body of emails using Mail.app.

Comments Off on Spotlight Cheat Sheet