MacOS – Mail.app rules stored? They got deleted and I want to restore them

emailmacosmail-rules

Since Mail.app had trouble connecting to the various accounts, I tried to 'reset' it by removing all accounts and the stored passwords in Keychain Access.app. Then I re-added all the mail accounts.

However, for some reason all configured rules were deleted too, even though they are not directly tied to a specific mail account.

Where are these rules stored so that I can restore them from a time machine backup?

enter image description here

Best Answer

The rules are stored in a property list at:

~/Library/Mail/V2/MailData/SyncedRules.plist 
  1. Restore this file from a backup.
  2. Restart Mail.app.
  3. Re-enable the rules.

These days check for a V3 folder (El Capitan). Restoring only the SyncedRules.plist may not work as another .plist file indexes the active state of the current rules set. What worked here was to go back to an earlier version of the ~Library/Mail/V3/MailData directory (note that it is in the V3 directory-- not the V2 directory). This takes a few minutes as Mail has to re-import your messages, but it did restore rules which were not restored by restoring the just the ~/Library/Mail/V3/MailData/SyncedRules.plist file only.