Spotlight Missing Files

Spotlight Icon
Spotlight Icon

How to fix your spotlight woes.</h3>

I use spotlight all the time to launch applications and open files. I recently ran into some trouble with files and applications disappearing from the spotlight index. I was able to fix the problem by deleting my spotlight index and rebuilding it.

System Preferences - Spotlight
System Preferences - Spotlight

First you should just make sure your spotlight settings haven’t caused the problem before you take the time to delete and rebuild your spotlight index. In system preferences go to spotlight. There are two tabs: Search Results and Privacy. Make sure the type of file you are looking for is selected and under privacy make sure the file isn’t located in any of the locations specified. Any location specified in the privacy tab will not be indexed.

Spotlight Search Results Preferences
Spotlight Search Results Preferences
Spotlight Privacy Preferences
Spotlight Privacy Preferences

Delete and Rebuild Spotlight Index

To delete and rebuild your spotlight index open up your terminal and enter in these commands. (You will need your root password to execute these commands)

<span>sudo rm </span><span>-</span><span>r </span><span>/.</span><span>Spotlight</span><span>-</span><span>V</span><span>100</span><span>
sudo launchctl load </span><span>-</span><span>w </span><span>/</span><span>System</span><span>/</span><span>Library</span><span>/</span><span>LaunchDaemons</span><span>/</span><span>com</span><span>.</span><span>apple</span><span>.</span><span>metadata</span><span>.</span><span>mds</span><span>.</span><span>plist
sudo mdutil </span><span>-</span><span>E </span><span>/</span>

NOTE: For most, copying and pasting these commands will  work just fine. For some of you it might come back on the first command that the file was not found. If this is the case for you it’s ok, we just need to find the right file. Paste the first line all the way up to the “V” like this:

<span>sudo rm </span><span>-</span><span>r </span><span>/.</span><span>Spotlight</span><span>-</span><span>V</span>

then just hit the tab key and it should complete the file name. You can now hit enter and paste the rest of the commands with no problem.

Explained

  1. Deletes the spotlight index file
  2. Sends secret message to the elves in your computer that make things happen
  3. Causes Spotlight to rebuild indexes

After you have rebuilt the index, you and spotlight can live happily ever after. :)

holding_hands_sunset
Resources:
Sunset Image: http://www.flickr.com/photos/mikebaird/ / CC BY 2.0
Terminal commands: Question I asked on superuser.com