Search Not Working on Mac El Capitan
At Boxaid we deal with countless Windows and Mac problems on a daily basis. We do everything from our virus removal service to fixing peripheral problems with our remote computer repair. But occasionally we run into a problem that is difficult to resolve and will share it with our blog readers. This is a problem that definitely took some time to figure out and we thought we would share it with everyone. We had a Mac user who recently upgraded their Mac operating system to El Capitan which is the latest OS upgrade from Apple at the time of this writing. After the upgrade their search functionality would no longer return file or email results. We tried all the usual articles from Apple on how to fix the Search functionality but none of them worked. Here’s how we fixed the Spotlight Search functionality.
What is Spotlight Search?
Spotlight, as it is named by Apple, is the ability to search for files, apps, emails and anything else on your Mac or the Internet quickly and easily using the Search bar in Finder, or Outlook or the Mail app. As in usual Apple fashion it is very easy and intuitive to use, except for when it doesn’t work. If your Spotlight search is not returning files or emails that you expect to see then there is something wrong with it.
Trying the Obvious Fix
Apparently there are a lot of people having problems with the search functionality and Apple has plenty of knowledge articles to address them. The most obvious fix for addressing this problem is attempting to force Spotlight to rebuild the search index by adjusting your System Preferences. But of course we tried this step several times, rebooted and we still were not able to search files or our Outlook email. You can try this fix found here https://support.apple.com/en-us/HT201716 It seems this fix solves many peoples problems, but it did not solve ours. So we kept on searching. In the end we had two problems, 1. Indexing and Searching was disabled and 2. We had a hidden file in our root directory called .metadata_never_index that was preventing indexing from occurring. So here are the steps we took to solve the problem. You will need to use a terminal window so get your keyboard skills ready.
Step 1. Disable then Re-enable Indexing
First start with opening up a Terminal Window. The Terminal can be found by bringing up Applications in Finder, then Utilities, then Terminal. Now lets figure out the status of indexing. Type either of these commands, both should do the same thing:mdutil -s / or mdutil -s /Volumes/Macintosh\ HD
If you get a message that says Indexing and Searching disabled then we may have found your problem. For reasons unknown, your indexing is disabled which is why Spotlight can’t find anything. Indexing is the process of finding all files, emails, and other stuff on your hard drive that you will eventually search for. Type the following two commands (Hit Enter after each line and type your password if prompted) which will disable searching and then re-enable it. This SHOULD force the index to be rebuilt.sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist
Now run the same commands below we ran before. This will let us know if indexing and searching has been enabled.mdutil -s / or mdutil -s /Volumes/Macintosh\ HD
If Indexing and Searching disabled is still showing then we may have a different problem. You will need to perform Step 2 below. Otherwise if it shows indexing is enabled you should be all set.
Step 2. Delete the .metadata_never_index File
We are not certain where this file came from but in our case it was preventing the indexing for search functionality from working. It’s also not very obvious because the file is hidden to the operating system. This is signified by the “.” in the beginning of the file. Any file that starts with a “.” will not be shown in Macs Finder by default. Let’s see if you have this file on your hard drive by typing the following command in Terminal. If the next line shows the file then you know you have it on your hard drive. If it doesn’t show the file then the next step may not do anything for you.locate .metadata_never_index
If you see the same result above then we need to delete this file. This is what is preventing the indexing from occurring on your Mac. Run the command below which will delete this file from the root of your hard drive.sudo rm /.metadata_never_index
If all goes well then you should be able to run the command below again and this time you hopefully see that Indexing is now enabled.mdutil -s / or mdutil -s /Volumes/Macintosh\ HD
Now Spotlight should start indexing your hard drive immediately. It may take some time for it to fully complete depending on how many files and emails you have. But you can see the progress by scrolling over the magnifying glass in the upper right hand corner of your screen. It will show you a status bar and let you know that it is indeed indexing your hard drive contents.