Apple Mail keeps resetting its rules

Sorry if this has been covered before, and also I know this is not SpamSieve’s fault — I’m just hoping someone has some advice.

My symptom is that Apple Mail keeps resetting its rules. So, I delete the Apple News rule and create the SpamSieve rule, moving “all” messages to All Junk. Works fine. After a while (perhaps after restarting the computer?) I come back and SpamSieve is mysteriously not working at all — except that it’s no mystery, because Apple Mail has deleted the SpamSieve rule and has re-created the Apple News rule. Why, Apple?

More info: This is a new M1 machine running Monterey. I copied the SpamSieve prefs and account settings as explained in the manual, in order to keep my training data from the old machine (that part is working fine, so long as the SpamSieve rule is actually present).

I should add: Apple Mail also keeps resetting its signatures (i.e. I configure signatures and after a while they are all gone). So clearly it is losing certain preferences from time to time.

This is probably because of incorrect file permissions or ownership on the folder ~/Library/Mail/V9/MailData/ so that Mail can’t save your changes to disk. (Or, less commonly, it could be caused by old versions of those files syncing back to your Mac from iCloud.)

What does it show if you enter this command in Terminal?

ls -le@Oh ~/Library/Mail/V9/MailData/

Note that you will probably have to grant Terminal Full Disk Access in order for this to work.

It says

drwxr-xr-x@ 2 mattm1  staff  -   64B Nov 19 20:25 BiomeStream
	com.apple.quarantine	  19B 
-rw-r--r--@ 1 mattm1  staff  -  926B Nov 23 08:45 DefaultCounts
	com.apple.quarantine	  19B 
-rw-r--r--@ 1 mattm1  staff  -   10K Nov 19 20:13 EMUbiquitouslyPersistedDictionary-com.apple.mail.listUnsubscribeInfo.plist
	com.apple.quarantine	  19B 
-rw-r--r--@ 1 mattm1  staff  -   11M Nov 23 08:34 Envelope Index
	com.apple.metadata:com_apple_backup_excludeItem	  61B 
	com.apple.quarantine	  19B 
-rw-r--r--@ 1 mattm1  staff  -   32K Nov 23 07:09 Envelope Index-shm
	com.apple.quarantine	  19B 
-rw-r--r--@ 1 mattm1  staff  -  1.1M Nov 23 08:46 Envelope Index-wal
	com.apple.quarantine	  19B 
-rw-r--r--@ 1 mattm1  staff  -   32K Nov 19 20:08 ExternalUpdates.storedata
	com.apple.quarantine	  19B 
-rw-r--r--@ 1 mattm1  staff  -   32K Nov 23 08:46 ExternalUpdates.storedata-shm
	com.apple.quarantine	  19B 
-rw-r--r--@ 1 mattm1  staff  -    0B Nov 19 20:08 ExternalUpdates.storedata-wal
	com.apple.quarantine	  19B 
-rw-r--r--@ 1 mattm1  staff  -  419B Nov 23 08:46 FlagMailboxes.plist
	com.apple.quarantine	  19B 
-rw-r--r--@ 1 mattm1  staff  -  1.0M Nov 23 07:22 LSMMap2
	com.apple.quarantine	  19B 
drwxr-xr-x@ 2 mattm1  staff  -   64B Nov 19 20:08 Protected Index Journals
	com.apple.quarantine	  19B 
drwxr-xr-x@ 6 mattm1  staff  -  192B Nov 19 20:25 RemoteContentURLCache
	com.apple.quarantine	  19B 
-rw-r--r--@ 1 mattm1  staff  -  364B Nov 23 07:21 RulesActiveState.plist
	com.apple.quarantine	  19B 
drwxr-xr-x@ 4 mattm1  staff  -  128B Nov 23 08:29 Signatures
	com.apple.quarantine	  19B 
-rw-r--r--@ 1 mattm1  staff  -  471B Nov 23 08:46 SmartMailboxesLocalProperties.plist
	com.apple.quarantine	  19B 
-rw-r--r--@ 1 mattm1  staff  -  370B Nov 23 08:46 SyncedFilesInfo.plist
	com.apple.quarantine	  19B 
-rw-r--r--@ 1 mattm1  staff  -  2.8K Nov 23 08:46 SyncedSmartMailboxes.plist
	com.apple.quarantine	  19B 
-rw-r--r--@ 1 mattm1  staff  -  1.6K Nov 23 07:21 UnsyncedRules.plist
	com.apple.quarantine	  19B 
-rw-r--r--@ 1 mattm1  staff  -  181B Nov 23 08:46 VIPMailboxes.plist
	com.apple.quarantine	  19B 

More info: just quitting Mail itself and opening it again is sufficient to cause resetting of the Rules. No need to restart the computer or anything like that. :slight_smile:

Those permissions look OK to me, but normally there should be a SyncedRules.plist file that stores the rules. So maybe it’s the containing folder that’s messed up and preventing the file from being created. What does:

ls -le@Oh ~/Library/Mail/V9/

show?

That would be

drwxr-xr-x@  4 mattm1  staff  -  128B Nov 23 09:48 2649A072-5B9F-48DE-890C-2A36142740BC
	com.apple.quarantine	  19B 
drwxr-xr-x@  5 mattm1  staff  -  160B Nov 23 09:48 366FC5C7-EB49-4695-A116-47D96CC0485E
	com.apple.quarantine	  19B 
drwxr-xr-x@  6 mattm1  staff  -  192B Nov 23 09:48 3948EE9F-1BC6-416B-943A-4A7609A8082F
	com.apple.quarantine	  19B 
drwxr-xr-x@  7 mattm1  staff  -  224B Nov 23 08:45 5316CBFB-0B84-4073-858F-949456015F61
	com.apple.quarantine	  19B 
drwxr-xr-x  15 mattm1  staff  -  480B Nov 23 09:48 6EA29711-6E90-45A9-BEE9-52D21E24E240
drwxr-xr-x@  9 mattm1  staff  -  288B Nov 23 08:46 DCE86CAF-7DDE-4DD9-BE06-14A2DEC2D3F1
	com.apple.quarantine	  19B 
drwxr-xr-x  22 mattm1  staff  -  704B Nov 23 09:48 MailData

I think that might be the key. I tried signing out of iCloud and so far everything seems fine and stable when I quit Mail and relaunch it. I’m going to try restarting the computer and see if it stays fine and stable! Also, the previous computer still exists, so I’m going to sign out of iCloud on that as well to make sure it isn’t interfering somehow.

You can be signed in but disable iCloud rule syncing from System Preferences ‣ iCloud ‣ iCloud Drive ‣ Options… and uncheck Mail.app.

Yes, I had tried that. Signing all the way out of iCloud and signing back in seems to have worked so far!

Yup, the settings are surviving. Thanks so much for the help! This might even be useful to someone else.

1 Like