Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Mail search not working in Mac mail on high Sierra

Searching in spotlight works and finds emails but when entering ANY criteria in the mail search field there are NO results - all emails disappear as if there are none that match the criteria. This includes the smart mailboxes, which return no results. Note that I do get results when using spotlight.


It is as if mac mail has disconnected itself from spotlight...


I have reindexed spotlight, reset NVRAM etc


iMac 20" 4Gb RAM 1Tb HD

High Sierra 10.13.3

Posted on Mar 12, 2018 3:09 AM

Reply
Question marked as Best reply

Posted on Jun 28, 2018 7:11 AM

I’ve been hunting for a solution to this as well, quite literally for years! Yesterday, for me at least, I found the cause as well as the solution. It's not pretty, but it works! Hopefully this works for you as well.

For me the issue appeared to point to the local folders beneath my "On my Mac" section of Mail. Emails stored in those folders were simply not being discovered when performing Mail searches. This led me down a path that ultimately gave me the idea to test something drastic. Exporting those folders (as if I were moving everything to a new computer), and then Re-importing them again.

I first tested this with one small folder under "On my Mac" since it would take less time to test a small folder versus a large one. I tested some searches in Mail for messages I know should show in the results but didn't. Of course I documented all of this so that I could re-test once that folder and messages within it were re-imported. It worked! Mac Mail reindexed those folders and their contents as if they were new when re-imported.

My theory here is that when upgrading, or moving to a new computer with a different OS than the one you're moving from (i.e. the OS of the computer you're Exporting FROM and the OS of the NEW computer you're Importing TO are different), the actual folders where those emails reside on your computer (under the ~/Library/Mail/V5/ folder) contain incompatible index files and are not updated (or at least not properly) when moving those messages. However, when Exporting them from the NEW computer's (or NEW OS) Mail app they're somehow fixed - or it may be when Re-importing them that those index files are rebuilt. Regardless, it works! I have literally tens of thousands of emails and this only took me a couple hours to complete - it's a fairly fast and relatively hands-off process once it gets going.

Here’s a link to an article on how to properly Export and then Import mail folders… https://support.apple.com/guide/mail/import-or-export-mailboxes-mlhlp1030/mac

A couple important notes (very important, please read)…

  1. Back up before beginning this process in case something goes wrong. You don't want to lose your email!
  2. Set up some test searches before you begin, like I did, and document those tests so you can perform them again once you re-import the emails.
  3. When you Export (see the link above), make sure and choose the “Options” button under the initial window where you choose your destination folder when Exporting, and select to “Export all subfolders”. This will ensure that your folder structure is maintained.
  4. There is no progress indicator when Exporting so what I did was noted the time I started the Export, and watched the "Modified" time under the destination folder's info window. Keep an eye on this modified time (which is the time the last modification was made to the folder). If it doesn't change for 30 minuntes or so it's likely finished. Be warned, if you assume it's finished before it really is, and start the Re-import process too soon, you'll lose emails. It's best to let this process run overnight to ensure the process completes. For example, if you start the process at 6pm the night before, wake up the next morning at 7am and see the folder's last modified time was 10:30pm the night before, it's safe to say it's finished. That said, spot check the folders in the destination folder (where you Exported the mail folders to on your computer) and make sure the folder count matches the number of folders in Mail that you expect to be Re-imported.
  5. When Importing again (see the link above), choose “Apple Mail” as the option in the opening window, not “Files in mbox format”. This can be a bit confusing based on the instructions under the above link.
  6. The Re-imported folders will be stored under a new "Import" folder at the bottom of the "On my Mac" folder list, so don't worry about the Re-import automatically replacing your old folders - that won't happen. Your old (original) folders will still be there until you delete them and replace them with the new Re-imported versions.
  7. Don’t delete the original folder/folders until you’ve tested the re-imported ones to make sure it worked as expected. Spot check the emails for accuracy by comparing the contents of the re-imported folders with those under the original folders.


Good luck! Hope this helps some people save time and frustration!

14 replies
Question marked as Best reply

Jun 28, 2018 7:11 AM in response to classysailing

I’ve been hunting for a solution to this as well, quite literally for years! Yesterday, for me at least, I found the cause as well as the solution. It's not pretty, but it works! Hopefully this works for you as well.

For me the issue appeared to point to the local folders beneath my "On my Mac" section of Mail. Emails stored in those folders were simply not being discovered when performing Mail searches. This led me down a path that ultimately gave me the idea to test something drastic. Exporting those folders (as if I were moving everything to a new computer), and then Re-importing them again.

I first tested this with one small folder under "On my Mac" since it would take less time to test a small folder versus a large one. I tested some searches in Mail for messages I know should show in the results but didn't. Of course I documented all of this so that I could re-test once that folder and messages within it were re-imported. It worked! Mac Mail reindexed those folders and their contents as if they were new when re-imported.

My theory here is that when upgrading, or moving to a new computer with a different OS than the one you're moving from (i.e. the OS of the computer you're Exporting FROM and the OS of the NEW computer you're Importing TO are different), the actual folders where those emails reside on your computer (under the ~/Library/Mail/V5/ folder) contain incompatible index files and are not updated (or at least not properly) when moving those messages. However, when Exporting them from the NEW computer's (or NEW OS) Mail app they're somehow fixed - or it may be when Re-importing them that those index files are rebuilt. Regardless, it works! I have literally tens of thousands of emails and this only took me a couple hours to complete - it's a fairly fast and relatively hands-off process once it gets going.

Here’s a link to an article on how to properly Export and then Import mail folders… https://support.apple.com/guide/mail/import-or-export-mailboxes-mlhlp1030/mac

A couple important notes (very important, please read)…

  1. Back up before beginning this process in case something goes wrong. You don't want to lose your email!
  2. Set up some test searches before you begin, like I did, and document those tests so you can perform them again once you re-import the emails.
  3. When you Export (see the link above), make sure and choose the “Options” button under the initial window where you choose your destination folder when Exporting, and select to “Export all subfolders”. This will ensure that your folder structure is maintained.
  4. There is no progress indicator when Exporting so what I did was noted the time I started the Export, and watched the "Modified" time under the destination folder's info window. Keep an eye on this modified time (which is the time the last modification was made to the folder). If it doesn't change for 30 minuntes or so it's likely finished. Be warned, if you assume it's finished before it really is, and start the Re-import process too soon, you'll lose emails. It's best to let this process run overnight to ensure the process completes. For example, if you start the process at 6pm the night before, wake up the next morning at 7am and see the folder's last modified time was 10:30pm the night before, it's safe to say it's finished. That said, spot check the folders in the destination folder (where you Exported the mail folders to on your computer) and make sure the folder count matches the number of folders in Mail that you expect to be Re-imported.
  5. When Importing again (see the link above), choose “Apple Mail” as the option in the opening window, not “Files in mbox format”. This can be a bit confusing based on the instructions under the above link.
  6. The Re-imported folders will be stored under a new "Import" folder at the bottom of the "On my Mac" folder list, so don't worry about the Re-import automatically replacing your old folders - that won't happen. Your old (original) folders will still be there until you delete them and replace them with the new Re-imported versions.
  7. Don’t delete the original folder/folders until you’ve tested the re-imported ones to make sure it worked as expected. Spot check the emails for accuracy by comparing the contents of the re-imported folders with those under the original folders.


Good luck! Hope this helps some people save time and frustration!

Apr 2, 2018 10:32 PM in response to classysailing

Hi Classysailing and every other frustrated Mac mail user:


I have tried all of the suggestions listed here and in every other post relating to the failure of Mac Mail to search correctly.


I unfortunately upgraded my MacBook Air (11 inch, 4,1 mid 2011) to Mac OS 10.13 (High Sierra from 10,12) and Mail search immediately stopped working. I have spent literally many many days on this problem. I am also using a Mac Pro ( 5,1) mid 2012 which I have not upgraded to High Sierra (and probably never will) which runs Mac OS 10.12. This machine has absolutely no problems with Mac Mail or anything else.


On the MacAir I have now abandoned Mac Mail and installed Thunderbird mail which runs perfectly. I know this is not a good solution, but until Apple solves this problem (if ever), I find it the only practical solution.


BTW, Spotlight also does not search mail correctly despite having attempted to re-index my drive in the two different methods suggested - by adding and removing from the Privacy tab in Sys Spotlight Prefs AND by using the mdutil commands in Terminal. Can't spend any more time on this - life is too short.

Jul 27, 2018 2:27 PM in response to classysailing

Hello all,


I have had a similar problem for months in mail. No email would get indexed. Nor in mail, nor in the mac spotlight would I be able to find my emails (not even mdfind). Althoug a "find in the terminal would find my emails".


I just found the culprit. The entire Mail tree on the file system had an extended attribute

"com.apple.quarantine", which you can find this way :

> ls -ld@ Mail

drwx------@ 14 simonpie staff 448 29 mar 19:51 Mail

com.apple.quarantine 19


So I removed the extended attributes this way :

> sudo xattr -rd com.apple.quarantine Mail


I added the ~Library folder to spotlight exclusion and removed it 20 seconds later. And tadam. Spotlight was reeindexing all my mails and emails were appearing in both mail and spotlight.


I hope this can help someone.

Mar 12, 2018 4:14 PM in response to classysailing

Hi there, classysailing!
Thanks for reaching out to the Apple Support Communities! It sounds like you are having an issue with searching your Mail and I am happy to help! You have tried excellent steps so far, and at this point, I would suggest checking out this article to Rebuild mailboxes in Mail on Mac and see if these steps resolve the issue for you.
Let me know the results and have a great day

May 18, 2018 11:23 AM in response to andruhvy

Same here... problem with searching via mail.... MacBook Air 2011..."upgraded" to High Sierra ...


mail does not search properly... what is silly.. if I open the individual messages that could not be searched... after opening them.... those individual messages are now "found" in the search.


I also tried spotlight... for some reason Spotlight is able to search my mail messages (that mail completely does not see!)


Anyone else found a solution... I'm not ready to give up.... yet.... but getting there.

Jun 28, 2018 3:34 PM in response to classysailing

It seems to have taken several months but at last something good has happened. The last update of High Sierra (MacOS 10.13.5) seems to have fixed the Apple Mail search problem, for me at least.


Now, I can get simple searches to work fine as well as having functioning smart mail boxes, neither of which was working before.


I hope it helps everyone else. It needs for you to check back after each update to see if things have changed. Now, unfortunately my mail is taking up twice as much disk space as I still don't dare delete the Thunderbird mail files as I don't completely trust the continued functioning of Apple Mail any more. But that is computers for you.

Jun 29, 2018 5:53 AM in response to andruhvy

I'm happy it resolved your issues, but we likely had somewhat different issues then. I've been running High Sierra 10.13.5 for several weeks and can say for me that update did nothing to fix my issues.


So, if you're reading this thread, and what you're experiencing are searches in Mail where SOME results show, but not ALL results (i.e. you know there are emails saved under your "On My Mac" folders that are not showing in the results no matter what "fixes" you apply), I assure you the method I outlined under my previous post will fix this. It did for me (the update did not).

Jul 2, 2018 1:20 AM in response to deilers

I tried all possible solutions I could find, but as nothing did help, I made an upgrade from High Sierra to the Mojave-beta which did actually solve this problem for me, mail search finally did work again!


But as I also had some strange freezes of some programs I deleted everything and made a clean install of the Mojave-beta and here we are again - mail search does not work!


So it is exactly the same problem as before, spotlight search does work, but searching in Mail does not. It cannot be a problem with the mailboxes or the "On My Mac" folders, as I only have iCloud folders.


Today I found an interesting posting here: mail.app - Mail search not finding messages but Spotlight does - Ask Different

The second answer - turning on unrestricted spotlight search - sounds promising, but as there is no more"com.apple.security.appsandbox" in Mojave, I cannot try it.

Jul 2, 2018 8:23 AM in response to RuRuKo

Update:

The method written in my last posting did the job for me, finally it works!


As there was no file with the name "com.apple.security.appsandbox" in /Library/Preferences I thought perhaps it was because of Mojave and went back to High Sierra with a clean install.


As expected, searching didn't work in Mail but it did in Spotlight, so I waited until Mail had downloaded all messages and then took a look at the /Library/Preferences folder, but as in Mojave there was also no "com.apple.security.appsandbox".

Nevertheless, I just entered the command:


sudo defaults write /Library/Preferences/com.apple.security.appsandbox \

UnrestrictSpotlightContainerScope -bool true


in the terminal, which created a com.apple.security.appsandbox.plist and after a reboot Mail searching is working fine.

Mail search not working in Mac mail on high Sierra

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.