Using Terminal to control Spotlight
Spotlight is the Macintosh technology that lets you search for things on your Mac. When you search for something like “dog” it not only finds that letter combination in the names of files but searchs the contents of the files for that term as well.
Occasionally Spotlight goes a little nuts and does things like continuously indexing your entire machine, which can slow things down. A good fix for this problem is to simply delete the Spotlight index and let it recreate itself. This can also fix problems where things aren’t showing up in a search that you know are there. The tool we use to do this is a command line tool called mdutil
To delete a Spotlight index enter the following in Terminal. Spotlight will automatically begin to rebuild the index.
sudo mdutil -E volume_name
If you only have one hard drive or partition on your machine or you want to rebuild the index on the drive you’re booted from use this syntax:
sudo mdutil -E /
If you want to rebuild the index on a different drive then your boot drive use this syntax. We’ll assume the drive is name “Extra Stuff”:
sudo mdutil-E "/Volumes/Extra Stuff"
If, for some reason, you find you need to completely turn off Spotlight use this command.
sudo mdutil -i on/off volume_name
To turn off Spotlight indexing on your boot volume use this syntax:
sudo mdutil -i off /
webmaster :: Sep.28.2007 :: System, Terminal :: 2 Comments »