If you’re wondering why you can’t figure out how to search mail rules on your Mac, it’s because Apple has not included a way to search your email rules for the Mac Mail app. Stupid, right? You would think that with all the other things that Apple gets right, something as basic and obvious as a way to search mail rules would be a no-brainer. Anyways, if you need to search your mail rules, here’s how to do it.
First, why would someone need to search their mail rules? Can’t they just look at the rules and find the rule for which they are looking? Sure, if you don’t have very many rules set up. But let’s say that you have dozens and dozens of rules set up in your Mac mail program, and you don’t want to have to scroll down through pages and pages of rules to find the one you want to edit or remove. Or maybe you have 100s of mail rules, and you need to figure out which one is triggering and causing certain email to skip the inbox, or maybe even to disappear entirely. This is when you start cursing the lack of a search function for your mail rules. And why we’re writing up how to do it (so you can stop cursing).
Actual Mail Rules from an Actual User’s Actual Mac
First, you need to know that this is not for the faint of heart. You’re going to need to go in under the hood of your Mac (software-wise, that is). However, it’s also not difficult.
How to Search Mail Rules for the Apple Mac Email Program
Your rules live in a text file called MessageRules.plist. The extension “.plist” stands for “property list”, although you can think of it standing for “preferences list”, because that is typically what these files contain: your preferences. For example, the MessageRules.plist file contains your email message rules preferences.
You will find the MessagesRules.plist file in the /users/(your username)/Library/Mail/(latest version number)/MailData folder (so for example for us it would be /users/InternetPatrol/Library/Mail/V8/MailData). The easiest way to find the MessagesRules.plist file is to type “MessageRules.plist” into your Mac Finder search bar.
Once you locate your MessageRules.plist file, be sure to copy this file over to somewhere safe, and only mess with the original file (keeping the copy that you made unmodified so that if you mess up you still have a pristine copy of your mail rules). We generally copy it over to our desktop.
The Internet Patrol is completely free, and reader-supported. Your tips via CashApp, Venmo, or Paypal are appreciated! Receipts will come from ISIPP.
Now open the MessageRules.plist file with your favorite plain text editing program; you want to edit the file in plain text because you don’t want any code slipping in there and messing things up. We use Text Edit (or we just emacs it, but that’s a whole other level of geekiness).
When you open the file you will see that each rule that you have created starts with “<dict>”. This stands for ‘dictionary’, and isn’t important right now (said in best Leslie-Nielsen-as-Rumack in “Airplane!” voice). In fact, we aren’t going to get into what each of the elements in your MessageRules.plist code stand for at all, because it’s not relevant for our purposes. We are just going to tell you how to search your mail rules.
It’s also important to note that there are nested instances of “<dict>”, and so a single rule can contain several “<dict>”s; be sure to look at our sample below to see what we mean.
Once you have opened the file, use the search function of your text editor to search for a string that you know all the emails being affected to have in common (or, if you know the name of the rule, just search for that).
Here is our example. Let’s say that we know that we have a rule named “Acme”, for email that we receive from Acme. Or it might be that we know we have a rule that is messing with all of the email that we get from [email protected] We open the file, and search for “acme”.
Below is the entire mail rule for Acme. It says, basically, “if we receive email from [email protected], file it in the Acme folder”. If we want to just get rid of the rule, we can delete the entire section, beginning with the <dict> which starts the Acme section, and ending with the </dict> which concludes that section. If, instead, you want to change the rule, we recommend not doing that by editing the rule itself, but rather by copying the rule, then deleting it and pasting it back in at the top of the file, just below where the MessageRules.plist file starts out by saying “<dict> <key>rules</key> <array>”. That way the Acme rule will be the very first rule that you see in your Mail.app’s rule preferences section.
Apple Mac Mail Rule for Acme, Puts Email from Acme.com in the Acme Mail Folder
<dict> <key>Active</key> <string>1</string> <key>AllCriteriaMustBeSatisfied</key> <string>NO</string> <key>AutoResponseType</key> <integer>0</integer> <key>CopyToMailbox</key> <string>~/Library/Mail/V2/Mailboxes/Acme.mbox</string> <key>CopyToMailboxURL</key> <string>local:///Acme</string> <key>Criteria</key> <array> <dict> <key>CriterionUniqueId</key> <string>a04ceff3-e0f6-4560-8c2f-155f69ea97c7</string> <key>Expression</key> <string>[email protected]</string> <key>Header</key> <string>From</string> </dict> </array> <key>Deletes</key> <string>NO</string> <key>HighlightTextUsingColor</key> <string>NO</string> <key>Mailbox</key> <string>~/Library/Mail/V2/Mailboxes/Acme.mbox</string> <key>MailboxURL</key> <string>local:///Acme</string> <key>MarkFlagged</key> <string>NO</string> <key>MarkRead</key> <string>NO</string> <key>NotifyUser</key> <string>NO</string> <key>RuleId</key> <string>FCC1A2E5-6771-4E63-A6CD-4B78D3E18202</string> <key>RuleName</key> <string>Acme</string> <key>ShouldCopyMessage</key> <string>NO</string> <key>ShouldTransferMessage</key> <string>YES</string> <key>TimeStamp</key> <integer>347814364</integer> </dict>
Note that one of the most common issues that we see when it comes to mail rules is that for some reason email seems to be just disappearing because some rule is deleting it on sight. The code for that rule is (as of May 2022, with Big Sur, at least):
So if you copy and search for that string, it may help you troubleshoot disappearing received email.