7

Since upgrading to Lion, my search in Mail has gotten drastically less helpful. Since I have read many reviews about what an improvement Mail 5.0's search is, I can only assume that my search index was not built correctly. Is there a file I can delete or a terminal command I can run to tell Mail to re-index my messages?

  • Is the search slow? The improvements are more along the lines of filtering with what Apple calls "tokens". – Nate Bird Jul 27 '11 at 18:48
  • No, I searched something that I knew without a doubt existed, and it never showed up. It just plain 'ol didn't find it. – finiteloop Jul 28 '11 at 15:53
4

Mail keeps a sqlite database of the index. To rebuild it, delete the index and restart Mail.

rm -f ~/Library/Mail/V2/MailData/Envelope\ Index
  • Mail is re-importing all of my messages as we speak. I have a feeling this is going to be the fix. When I first launched Mail 5.0 I had an incompatible plugin installed and I think Mail's warning me of that caused the importing of mailboxes to stop short. – finiteloop Jul 28 '11 at 15:57
  • Note: running this command will wipe out your local cache of mail messages and require Mail.app to re-download everything. If all you want to do is rebuild your search index, see the mdutil command provided by aaltonen – emmby Jul 5 '12 at 19:11
4

Here's what I've used in the past to rebuild the search index:

sudo mdutil -E /

The -E option "will cause each local store for the volumes indicated to be erased. The stores will be rebuilt if appropriate."

While I don't use Mail.app, I noticed similar behavior with Outlook 2011 -- which also uses Spotlight for search.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .