Rebuild Spotlight index in MAC OS X

Rebuild Spotlight indexSince not long ago I have also become a proud owner of an Apple product. After 10 years of Windows-monarchy, the first Apple device, a 13“ Macbook Air, has managed to enter my IT scene, with the result that from now on, in addition to the Windows articles and occasional Linux articles, there will be also some articles about Apple/ MAC OS X.

But let us now get back to the actual topic. The universal search tool Spotlight in Mac OSX is without doubt very powerful. But if Spotlight strikes and if it doesn’t find all apps or files, it loses its sense. In such cases it could be helpful to set the index up again or reincorporate even just a single app in the index.

Narrow down the problem

If Spotlight doesn’t provide the desired search results anymore, even though the searched app is by all means in the system, then there are at least two ways to solve the problem.

The right approach to the problem depends from the problem itself. If only a single app is missing, this might be due to fallaciuos attributes. However, if more apps or files are missing, then it helps to cancel the Spotlight index and re-establish it afterwards.

Adding single apps to Spotlight

If only a single app is missing, the problem might be due to wrong attributes. This can be verified by using the mdls-command in the terminal. In this case a call in form of mdls /Applications/Name of the | grep MDSystemFile is sufficient.

For Safari the recall would look like this:

mdls /Applications/ | grep MDSystemFile

If this call leads to only one result (only one string is found), it means that the app is affected by the problem. This issue can be solved by using the following command:

sudo xattr -w "" /Applications/

In oben stehendem Befehl müsst ihr natürlich das Safari durch den Namen/Pfad eurer App ersetzen.

In the command above you have to substitute the Safari with the name/path of your app. If your app is not affected by the problem of the attributes, you can still try the second problemsolving approach – the regeneration of the Spotlight searchindex.

Recomposing Spotlight’s search index

If the first approach to a solution didn’t work or rather didn’t show the expected symptoms, it could help to regenerate the complete (search) index of Spotlight. Four command, which you have to insert in your terminal, are necessary to do so.

The first command stops Spotlight:

sudo mdutil -a -i off

The second command deactivates the Spotlight Service and the index:

sudo launchctl unload -w /System/Library/LaunchDaemons/

The third command reloads the Spotlight server:

sudo launchctl load -w /System/Library/LaunchDaemons/

The fourth command re-starts Spotlight:

sudo mdutil -a -i on

After the fourth command Spotlight should start again and inform you that the index is being compiled again. This could last a few minutes, depending on the capacity of the system and the number of the apps and files.

When the process is completed all apps should be found again.

Further suggestions and solutions

If these two solutions helped you, I’d be happy for any feedback. If these two solutions didn’t lead to a success, but you managed to find another way of solving the problem, please simply send me a comment.
If there are no reasons that might make it unadvisable, I will extend the article and of course I will make mention of your name in it.


  1. Hi, you and your readers may be interested in the following:

    I decided to uninstall (manually) “TextWrangler” mainly because i had noticed that the “kind” file attribute for 1000’s of source code files had been modified to “TextWrangler Text Document”. Initially i thought that the metadata had been changed and was researching methods of correcting this. However luckily i decided to regenerate ‘Spotlight’ which to my surprise was all that was needed to correct things.

Leave a comment

Please be polite. We appreciate that. Your email address will not be published and required fields are marked