Spotlight is great. Most of the time I find it works flawlessly. Occasionally it breaks, which means it just stops working in some way. This will affect many aspects of OS X that we may not realise are depending on Spotlight. For instance:
Apple Mail depends on Spotlight to perform full message searching. Searching in the From, To, date, and subject fields does not need Spotlight. But searching the body does. If mail has stopped being able to search the body of your messages, chances are Spotlight has broken.
Finder also depends on Spotlight for its search function. If you start getting no results in finder searches, even when searching for things you know are there, it’s likely Spotlight broke.
Of course the main access to Spotlight is via the magnifying glass on the far right of the menu bar at the top of the screen. If that stops churning out results when you type something into it, Spotlight is most certainly busted. Something which happened to me recently was that I swapped my main hard drive for a cloned drive. Spotlight spat the dummy when it tried to index the new drive. It just sat there saying it was building the index (for an entire day and night). I realised it had frozen up. The first option below fixed it.
How to correct common Spotlight issues
Note: Many of these tips assume you know how to use Terminal. You will find it in the Utilities folder in your Applications folder.
Restarting ‘SystemUIServer’ to fix basic Spotlight interface issues
As mentioned above, recently the spotlight interface got stuck. I’d click the magnifying glass and there would be a message saying Spotlight was building the index. It also said it was calculating the estimated time this would take, but nothing more would happen. The following fixed it:
- Launch ‘Activity Monitor’ (located in /Applications/Utilities/)
- Locate the process ‘SystemUIServer’, highlight it, and click the red button “Quit Process”
- Within a few seconds the menubar will rebuild itself and often Spotlight will magically work
Rebuilding Apple Mail Index
If it is only Apple Mail giving you search issues (as mentioned above) try this:
- Open Terminal.
- At the command prompt type (or copy/paste) in: mdimport ~/Library/Mail
- This command will rebuild the Mail folder index.
- If that does not fix the search system in Mail (and assuming Spotlight is still working in general) you could try this: Go to Spotlight Preferences in your system preferences. Go to the Privacy tab. Add ~/Library/Mail to the privacy list. Change the preferences panel back to the Show All panel. Go back to the Privacy tab and remove ~/Library/Mail from the list.
Rebuilding entire Spotlight index
If all Spotlight dependant features have died, try this:
- Launch Terminal (which is located in /Applications/Utilities/)
- Make sure Spotlight is turned on by typing or pasting at the command prompt in Terminal the following: sudo mdutil -i on /
- You will be prompted in Terminal for your password. Enter that.
- Try to do a search with Spotlight, or in Mail (if that is where you problem was).
- If the problem still exists, use the following command in Terminal to make Spotlight recreate its indexes: sudo mdutil -E /
It may take some time for Spotlight to create a new index. If you try right aware to use Spotlight it should show a message saying it is in the process of indexing.
Clear caches and preferences
Clearing the caches and preferences relating to Spotlight for sometimes fix the issue. The easiest way to to this is with either the free tool OnyX, or the free tool MainMenu. If you want simplicity, MainMenu is easier for novices
- Install MainMenu
- After installation of MainMenu a little Hammer and Wrench icon will appear in your menubar
- navigate down to ‘Cleaning’ and clean out User Cache, System Cache, and Font Caches
Note: You may discover that just cleaning the Font caches is adequate to repair Spotlight, although it won’t hurt to clear them all
Remove corrupt dictionaries (more drastic, and likely to not be necessary)
This can also resolve certain Spotlight issues for some users. It is more drastic and requires installing the latest OS X combo updater. Try this only as a last resort.
- Move (to somewhere you can find them again) all items from /Library/Dictionaries
- Restart and see what happens. If this works, download the Mac OS X combo updater that corresponds to your OS X version, and install it.