Today's post comes from reader Tracey from Australia. She asks, "Since I upgraded to Yosemite on my iMac, the search function in Mail is not working. How do I fix this?"
The search functionality of Apple's Mail app is one of the many reasons I love using Mail. Fortunately, it doesn't fail very often, but when it does, it can be frustrating. The good news is this... it's easy to fix! Here's how.
There are two ways to fix this problem. Method 1 targets the searchability of Mail itself, while Method 2 fixes searchability for the entire system (Spotlight). Since you are having issues specifically with Mail, let's talk about Method 1 first.
In order to provide quick results when searching through all your mail, OS X builds index files (actually, they're called "envelopes"). When you perform a search, you're actually searching these envelope files, which in turn points Mail to the email it's looking for. If these envelope files become corrupt, searchability fails. In order to fix it, they need to be rebuilt. Here are the steps to do that.
First, we need to Quit Mail (not just close by clicking the red button, but Quit all the say... Mail > Quit). Next, we need to delete the existing envelope files. To do this, we will need to open a Finder window then click on Go > Go to Folder... in the menu bar.
Next, we will enter "~/Library/Mail/V2/MailData" and press "Go".
This will take us directly to the location where the envelope files are stored. Next, located any file beginning with "envelope" (there should be three), select them and move them to the trash.
With our envelope (index) files now gone, we will need to rebuild them. Doing this is super simple... just re-open the Mail app. When you launch Mail, you will be presented with a pretty scary message that almost looks like you just lost all your mail.
Don't worry! This is normal. Simply click "Continue" and your envelope files will be rebuilt. After the initial rebuild has completed (usually within a few minutes), you'll nee to exercise some patience. The full re-indexing process can take a while, depending on how much email you have. When this process has completed, Mail searchability will be restored to normal.
In some cases, lack of searchability in Mail means lack of searchability system-wide using Spotlight. If that's the case, you will need to reset your system-wide index files. Here's how to do that.
First, let's open System Preferences and click on Spotlight.
At this point, you are presented with a list of options for Spotlight. We'll ignore these for now (but I do recommend spending time looking through these later on). Next, we need to click on the "Privacy" tab. This is where we can specifically exclude certain folders from being included in our Spotlight searches. In order to rebuild our index files, we need to exclude our Macintosh HD (stick with me!) by clicking the [+] button, selecting the "Macintosh HD" drive on the left side of the Finder window, then clicking "Choose". You will be presented with the following message:
Click "OK" and the resulting window should look like this:
Now that we are excluding the entire Macintosh HD from Spotlight, there's only one thing left to do... remove it from the list. You heard me... remove it! Simply highlight the "Macintosh HD" drive and click the [-] button. By doing this, we are commanding OS X to re-index the entire drive. This process could take a little time to complete (and should have very little, if any, impact on system performance), but once it has completed, your system-wide Spotlight searching should be restored to full health!