I have a personal account setup on three different Macs—my own MacBook Air, an iMac that serves as our home server and the kid’s mini. In my account on the iMac, I had Mail running with an elaborate set of rules, including those related to [spam handling](/2012/08/11/running-your-own-server-side-spam-filter-with-spamsieve/).
This morning, I woke up to discover loads of unfiltered messages in Mail on my iPhone. I checked the rules panel in Mail on the iMac and discovered _all my custom rules were gone_.
I couldn’t understand how this happened, since I have Mail syncing _disabled_ in the iCloud preferences. After some googling though, I discovered that it’s the “Data & Documents” that controls the syncing of Mail rules—a sync setting I can’t disable (since I need data and document syncing in other apps.)
This left me with three questions:
1. How did I lose my rules?
2. Can I restore my rules?
3. How does rules syncing work? (So I can avoid this happening again.)
##### How did I lose my rules?
Two things happened this weekend which could have triggered the sync that caused this to happen, both related to installing Drive Genius 3:
1. Drive Genius reported that the startup volume on my MacBook Air needed repairing. I rebooted from a bootable backup that Carbon Copy Cloner supposedly keeps up to date with a nightly backup.
The Air booted into a state from the past. Apps launched that hadn’t been launched in a long time, Dropbox didn’t realize it was installed, etc. — basically a mess. (So that’s another mystery to resolve, later…) Mail launched, but I didn’t think to check its rules setup.
2. Drive Genius on the kid’s mini tried to send a mail, which opened Mail.app in my account on the mini, for the first time. I suppose a sync could have happened in its setup.
I don’t know which of these was the culprit.
##### Can I restore my rules?
Someone in the Apple Discussion forums claimed you can restore lost Mail rules by restoring this file from a Time Machine backup.
Every time I restored this file (including other files I found in MailData that seemed related), they would _immediately_ get updated once I launched Mail, leaving me with the same minimal set of rules.
So I guess I’m left with having to re-create them all, which motivates me to understand…
##### How does Mail rules syncing work?
The iMac ended up with about six Mail rules I had created long ago. When I checked my MacBook Air though—expecting to find _its_ rules lost—they were all intact! So I thought I’d recreate the rules on the Air, but rules I add there are _not_ getting propagated to other Macs.
So, how Mail rules syncing works remains a total mystery to me.
##### Update 2013-05-28
Michael Tsai [suggests](https://twitter.com/mjtsai/status/339112519115345920) removing this file, so that my other restored files can overwrite iCloud:
@mhenders Did you check ~/Library/Mobile Documents/com~apple~mail/Data/MailData/ubiquitous_SyncedRules.plist ?
— Michael Tsai (@mjtsai) May 27, 2013