Spotlight is one of the most under-used features in OS X. It’s ability to not only find folders and files but to act as an application launcher makes it an invaluable addition to OS X.
If you’ve ever changed a large number of files on your Mac you may have noticed Spotlight reindexing itself to locate all the files. This is an automatic feature that you have no control over, so if you’ve changed what you feel are a lot of files but Spotlight hasn’t reindexed, it may be time to force your Mac to rebuild the Spotlight index manually.
Before getting into how to rebuild the Spotlight index, it’s worth explaining why you’d want to. Spotlight keeps an index of every file on your Mac. This means when you click on the Spotlight icon in the OS X menu bar you can instantly find files and applications. The reason rebuilding is necessary from time to time is because when large amounts of files are changed Spotlight can sometimes miss things, making it inefficient and overall a pain to use.
By rebuilding the index, Spotlight always has the most up-to-date list of your files.
SEE ALSO: Get to Know Terminal: An Intro
Step 1: Terminal
Even though Spotlight will do this automatically, you can set the Spotlight index to rebuild manually by using Terminal. To get started, first open up Terminal (Applications > Utilities > Terminal) and enter the following command:
sudo mdutil -E /
Since this runs using a Super User Do (sudo) command, you’ll need to enter your admin password. Terminal will look like you’re not typing anything, that’s OK though, this is done for security.
Once you’ve entered your password hit the Return key. This will start the rebuilding process.
SEE ALSO: 5 Fun Terminal Commands to Try Right Now
Step 2: Spotlight
Once the command listed above begins to run in Terminal, it will stay active until the rebuilding is complete. If you click on Spotlight, you should see the following:
Spotlight will be unavailable while the indexing is taking place. The process will take some time, and it will vary on the size of your drive and number of files. There’s really nothing else for you to do until the process is complete, so it’s a good idea to run this when you’re not planning on being on your Mac, like over night.
Step 3: Rebuild Specific Drives
If you only notice an issue with Spotlight not working correctly with files on a certain drive, you can rebuild that specific drive just as easily as doing the entire system.
There are two ways to rebuild a specific Spotlight drive index. First, you can enter this command into Terminal:
sudo mdutil -E /Volumes/(DriveName)
Just replace (DriveName) with the name of the volume you want to rebuild the index for. The second way is somewhat easier, but involves a tiny bit of work from outside Terminal. Enter the original command listed above:
sudo mdutil -E /
but instead of hitting Return immediately, drag and drop the drive you want reindexed into the Terminal window.
SEE ALSO: Use Spotlight as a Calculator
The rebuilding process will take some time and your Mac will be a little sluggish until the process is complete but once it is, all your files should be ready for Spotlight to find them.
You can read more about Spotlight from Apple’s help documentation here.