13

When I search for a particular message in Mail.app, using the search field, even when I have the message in sight, Mail cannot find it. But, frustratingly, when I use Spotlight, it is able to find the message.

For example, I'll open a folder with a variety of recipes. I can see all the subjects and I see an email with the subject: "Smoothies". Typing in "Smoothies" into the search field brings up 0 results. But typing in "Smoothies" into Spotlight shows the desired message.

How can I get Mail.app to search correctly?

I'm running Mac OS X 10.11.3.

4 Answers 4

16

Rebuilding Mail.app's mailboxes fixed this for me. This ComputerWorld article is a great reference for rebuilding and reindexing your mailboxes:

  • Rebuild: Select a mailbox (or several by shift-clicking) and then use "Mailbox > Rebuild"
  • Reindex: Quit Mail, navigate to ~/Library/Mail/V2/MailData (on Mac OS 10.12 - Sierra, ~/Library/Mail/V4/MailData) and delete any files where the name begins with Envelope Index. Mail will rebuild the indexes on the next start (which may take a long time depending on the size of your mailboxes)
5
  • 1
    When I delete the Envelope files (three of them) from the V3/MailData directory on Mac OS 10.11, I get a message on next opening about migrating mail from the previous version of Mail, which isn't what the article said. So I put them back. But search still isn't working at all.
    – Wildcard
    Jun 13, 2017 at 6:44
  • Problem occurred out of the blue without my changing anything (that I am aware of). Rebuilding did not help, but reindexing sure did! Thanks!
    – bsumirak
    Aug 3, 2017 at 13:59
  • Rebuilding was unsuccessful, but the Reindex worked. To @Wildcard's point, yes, I got the same warning about migrating. I went ahead and selected continue and Mail recreated the Envelope* files.
    – KenB
    Sep 10, 2018 at 15:35
  • I tried reindexing but still searching doesn't work. Aug 16, 2019 at 7:42
  • Re-indexing worked here, but took hours to complete with no obvious indication that it's still being worked on, which is quite confusing.
    – not2savvy
    Feb 1, 2022 at 14:29
5

This helped me - it allows unrestricted spotlight search - and, after executing that command, mail search and smart mailboxes worked again

Open terminal from the utilities folder and execute:

sudo defaults write /Library/Preferences/com.apple.security.appsandbox \
    UnrestrictSpotlightContainerScope -bool true
2
  • This has also worked for me every time I have this problem. Jun 1, 2017 at 20:55
  • 1
    Well - this seems to help also in my case. But - this doesn't look like a solution but rather like a workaround to a deeper problem. It seems like we are relaxing some security related restrictions, which we shouldn't have to do in the very first place. But yes, it works for me too (after restarting Mail.app),
    – silverdr
    Aug 6, 2018 at 9:31
5

for years I had this problem (on and off) and tried everything I could find. Finally I found this: for some reason indexing was turned off and I had to 'switch it on' with sudo mdutil -a -i on After that mail search immediately worked. Hope this will make a few people less frustrated with mail (like I was)

2
  • For years I had this problem on one of my several devices and this was the solution!! Thank you!!
    – Todd
    Aug 1, 2017 at 1:25
  • This was the only solution that worked for me on High Sierra Version 10.13.6. Thanks!
    – Ling Toh
    May 13, 2019 at 16:54
1

I just migrated my email from 10.13 tot 10.14 to find out i had this problem as well. The only solution that worked for me was nr 4

sudo defaults write /Library/Preferences/com.apple.security.appsandbox \
    UnrestrictSpotlightContainerScope -bool true

problem is since some only need this one item and others need more steps, perhaps there are multiple problems to be solved with the same end symptom.

Letting security relax Container Scope is quite vague and not documented, but it worked for me.

You must log in to answer this question.

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