By Russell Harris :
Whilst delivering an Apple Certified OS X Server Essentials course this week (http://training.apple.com/pdf/yos101.pdf) (http://www.amsys.co.uk/course/os-x-server-essentials-10-10/), one of my students experienced a malfunctioning Spotlight where search results were not working.
I have come across this issue a couple of times and therefore decided that it was time to blog about what can be done to resolve this.
Firstly, lets explain what Spotlight is.
Spotlight (https://support.apple.com/en-gb/HT204014) is a feature containing an indexed database used in OS X to quickly access file information on your Mac and display these results to you within the OS X Finder.
You can pretty much search for anything within Spotlight by selecting the Magnifying glass in the top right hand corner of your Mac’s screen or using the shortcut keys of ‘cmd’ + ’spacebar’ and entering what you wish to search for. This could be an Application, a Game, a file or folder, a dictionary word, you can even use spotlight to perform web searches or perform calculations!
Now, the most common issues with Spotlight are that it displays no results, or only partial results. The issue which i experienced this week is that Spotlight only shows some results such as Dictionary and Web search results, but not Applications, files and folders.
You can see below i am attempting to search for ‘iTunes’ which i know is installed on my Mac, however the iTunes application is not displaying as a search result :
The first thing to check is the Spotlight preferences to ensure that Spotlight has been configured to search for the type of criteria you are looking for, in my case i need Spotlight to show me Applications in the search results :
As you can see, Applications is ticked and therefore should appear in the results. Obviously you would tick the box for what you want to search for if it wasn’t already!
The next thing to try is to force Spotlight to re-index folders or entire volumes as suggested by Apple on their support article (https://support.apple.com/en-us/HT201716)
You can force Spotlight to re-index your entire system hard disk with these steps:
Step 1: Go to the Privacy tab in the Spotlight system preferences :
Step 2: Click the Plus ‘+’ button in the lower left hand corner.
Step 3: Press ‘Shift’ + ‘Command’ + ‘C’ to reveal your hard drives or navigate to your system hard disk manually if this shortcut does not work.
Step 4: Select your system startup hard drive (usually Macintosh HD, unless you have renamed it manually) :
Step 7: Quit System Preferences and restart your Mac.
Step 8: Go back to Spotlight System Preferences and select the ‘Privacy’ tab, then remove your hard disk from the list by selecting it and pressing the Minus ‘-‘ button in the lower left hand corner.
This will force your Mac to re-index your hard drive which usually resolves Spotlight issues.
You may need to wait a few minutes for Spotlight to re-index your drive, you will know when Spotlight has finished as the ‘Indexing’ progress bar within the Spotlight window will disappear :
This often resolves Spotlight issues but not for my student in my class this week!
So, i had to bring out the big guns and use the command line!
The Spotlight index is stored on your hard disk as an invisible folder so that you cannot visibly modify or access it.
Re-indexing your hard disk as mentioned above does not delete the entire Spotlight index folder and settings, just modifies it to re-index your system drive.
To remove the entire Spotlight database and force it to be recreated, you need to run a unix command to delete the entire Spotlight database :
Step 1: Login as an Admin user on your Mac.
Step 2: Navigate to /Applications/Utilities on your computer and open Terminal.
Step 3: Enter the following command shown in bold and italics : cd /
Step 4: Press the Enter/Return key and your Terminal window should look like this :
You have now ‘changed directory’ to the root level of your system drive which is where the invisible Spotlight database is located.
Step 5: Now enter the following command in Terminal shown in bold and italics : sudo rm -R .Spotlight-V100/
Step 6: Press the Enter/Return key and your Terminal window should look like this :
Step 7: Enter your admin password and press the Enter/Return key, your Terminal window should provide no errors if you entered the unix command correctly and will return to a command prompt as shown below :
Step 8: Quit Terminal and restart your Mac.
Step 9: Log back into your user account and select the Magnifying glass in the top right hand corner of your Mac’s screen or press the shortcut keys of ‘cmd’ + ’spacebar’ to open Spotlight. Enter ‘iTunes’ or whatever you were initially searching for and you should see Spotlight report that it is re-indexing :
Step 10: Wait for the re-indexing to complete and retest. Your Spotlight should be reset and working again :
I hope you found this tip useful, it certainly seems to be an issue that crops up every now and again and does not seem to be tied to a specific version of OS X.
If you would like to learn more about OS X or just the Mac in general, then take a look at our collection of introductory training courses: (http://www.amsys.co.uk/training/getting-started-and-creative-courses/).
Since the latest version of OS X (OS X El Capitan 10.11) is still a recent release, if you support OS X clients, why not attend our 1/2 day Supporting OS X El Capitan seminar to discover other new features and also support and troubleshooting tips (http://www.amsys.co.uk/events/support-os-x-el-capitan-seminar/)
We also have a large collection of Mac and support courses which you may also find useful: (http://www.amsys.co.uk/training/courses/mac-os-x-training-courses/)
If you would like to discover more about iOS, then hop on over to our iOS user and support courses : (http://www.amsys.co.uk/training/ios-it-training/)
While the author has taken care to provide our readers with accurate information, please use your discretion before acting upon information based on the blog post. Amsys will not compensate you in any way whatsoever if you ever happen to suffer a loss/inconvenience/damage because of/while making use of information in this blog.
These features were tested using OS X El Capitan v10.11.1 which was the latest Mac OS release at the time of writing.