Customise Spotlight and solve indexing problems in OS X

Spotlight is a useful tool for finding apps, documents and other files on your Apple Mac’s disk drive and it is even better in OS X Yosemite, but sometimes problems occur. One is where Spotlight only gives web results and Spotlight does not index the disk drive. These indexing problems can be fixed and Spotlight restored to full health.

Spotlight problems

How do you know if Spotlight is working or not? You can test it by clicking the magnifying glass at the right side of the menu bar at the top of the screen to open it, Enter a search term, such as the name of a file you know is in the Documents folder, or the name of an app in the Applications folder. You could type Calendar for example and Spotlight should return the Calendar app as part of the results, but does it?

Spotlight indexing problem

Here you can see the result of searching for Calendar in Spotlight running on OS X Yosemite. All the results are from the web, such as a Wikipedia entry, suggested websites and a definition of the word. No app is displayed and according to Spotlight it does not exist on the Mac.

A search for a document you know is in the Documents folder produces a similar result and there are websites and definitions of the word that is entered, but no file. I have a document about llamas on the disk drive (I’m weird, I know), but the Spotlight search just returns a Wikipedia entry and web search suggestions. The document cannot be found on the Mac’s disk drive.

Spotlight indexing fault

Solve Spotlight indexing problems method 1

There are three ways to solve the Spotlight indexing fault and it is best to try the simplest one first. Go to the Apple menu in the top left corner of the screen and select System Preferences. Open Spotlight and select the Privacy tab.

Spotlight privacy options

It should look like this and any items that are listed are locations that Spotlight ignores. If there are any items listed, select each one in turn and click the minus button at the bottom to remove it.

It is more than likely that the list is empty, which means in theory that Spotlight is indexing the whole disk drive. The Spotlight searches show that it clearly is not. Click the plus button at the top, get to the root of the disk by clicking the menu just under the window title, the and add the disk drive. Alternatively, you could select and add the /Users and /Applications folders.

Turn off Spotlight indexing

When a disk drive or folder is added to the exclusion list, Spotlight turns off indexing for them. Close System Preferences and restart the Mac. When the desktop reappears, return to the Privacy tab of Spotlight in System Preferences and remove everything you added. Close System Preferences and restart the Mac.

Removing the disk drive or /Users and /Applications folders will turn on indexing for these items. Spotlight will then index them and they will be displayed in Spotlight searches.

Well, that is the theory anyway. Sometimes this does not work and Spotlight still does not return the right search results.

Solve Spotlight indexing problems method 2

Here we have to get a bit more technical and resort to entering commands in Terminal. Go to the Applications folder, open Utilities and run Terminal. A command prompt window opens. Type sudo moduli -E

Terminal in OS X

You will be prompted to enter your administrator password, that’s the sudo part. The mdutil command controls how Spotlight manages its indexing and the -E parameter tells Spotlight to erase the current index and rebuild it.

Close Terminal and restart the Mac. Wait a few minutes to let it rebuild the index and then try a Spotlight search to find an app or file you know is on the disk drive. It should be displayed.

Unfortunately, this does not always work and some people will need another command.

Solve Spotlight indexing problems method 3

If Spotlight is still not working, open the Terminal again and this time enter sudo mdutil -a -i on

Fix Spotlight from the command prompt

The -a means apply to all volumes and -i on means turn on indexing. You can see in the screen shot that indexing is indeed on. If you want to confirm that Spotlight is indexing, open Activity Monitor in the Applications/Utilities folder and it appears on several tabs, such as the CPU tab, when it is indexing.

Activity Monitor in OS X

When it has finished indexing, try some searches. A search for Calendar now produces the correct result and the Calendar app is listed as a top hit.

Spotlight searching in OS X

I can now find my lost llama document too.

Searching with Spotlight in Yosemite

Spotlight is finally working again!



Add new comment

By submitting this form, you accept the Mollom privacy policy.

Related items you will like...