Spotlight searches on my Macbook Pro running OS X 10.10.5 (Yosemite) were failing. Worse, the smart mailboxes in Apple Mail weren’t working. Without smart folders, it takes me a lot longer to navigate my inbox every morning.
The solution was to force OS X to re-index my hard drive.
I did a few Internet searches along the lines of “smart mailboxes stopped working” or “spotlight searches fail.” They yielded several suggestions, most of which didn’t work. What that means, I guess, is that my solution may not work for anyone else, but here it is.
If your smart mailboxes are failing, quit Apple Mail. Open the Terminal application and enter these commands:
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist sudo /bin/rm -rf /.Spotlight-V100/ sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist
sudo command will require your password. Assuming you enter the next two commands within a minute or so, you should only be required to type your password once.
After that, the Apple metadata utilities will start indexing your files. If you have a fairly empty SSD like I do, the index will take only a few minutes to rebuild. If you have a loaded traditional hard drive, I suggest you do this before you go to bed, because it will take a while.
Once I restarted Mail, all my smart mailboxes were populated again—and Spotlight searches worked again.