1

I'm running macOS Mojave 10.14. Mail.app and our Exchange server periodically quit talking to one another. The primary symptom of this is that the Inbox shows nothing even though webmail and my iPhone show plenty of messages.

blank Mail.app

Prior to the upgrade to Mojave, I was able to shut down Mail.app, delete the ~/Library/Mail directory and restart Mail.app. This caused Mail to re-download everything from Exchange and we were fine for a while. I even pruned my Exchange account so it wouldn't be a multiple GB download every time this happened, hoping that maybe an old message was causing something to get hung up.

So, I tried to do this again, but this time, I got rewarded with:

wowbagger:Library brianm$ rm -rf Mail
rm: Mail: Operation not permitted

If I ls -ld@ the Mail directory:

wowbagger:Library brianm$ ls -ld@ Mail
drwxr-xr-x@ 4 brianm  staff  128 Oct  5 11:26 Mail
    com.apple.quarantine     -1 

Okay, the regular UNIX permissions look fine, but it also has an extended attribute. If I delete that attribute, I should be able to then delete the directory.

wowbagger:Library brianm$ xattr -d com.apple.quarantine Mail
xattr: [Errno 1] Operation not permitted: 'Mail'

Hmm. What if I clear all attributes?

wowbagger:Library brianm$ xattr -c Mail
xattr: [Errno 1] Operation not permitted: 'Mail'

Of course sudo doesn't help any of these commands. For example:

wowbagger:Library brianm$ sudo xattr -c Mail
Password:
xattr: [Errno 1] Operation not permitted: 'Mail'

Other directories also have that com.apple.quarantine attribute:

  • SafariSafeBrowsing
  • iTunes
  • Calendars
  • Cookies
  • Safari

So, how do I either fix what's going on in Mail or somehow delete that Mail directory so it will rebuild it from scratch?

  • Executed xattr against ~/Library/Mail and it had the quarantine attribute. xattr -d com.apple.quarantine Mail removed the attribute on Mojave. Did not need sudo – Hogstrom Nov 1 '18 at 16:01
  • Hmm. Do you think I’ve got a disk going out then? I’ve already had the fusion drive replaced once. I tried to convince the genius to upgrade me to an ssd (me paying whatever difference), but he refused. Instead they put another fusion drive in. – bmauter Nov 2 '18 at 22:21
  • Can't say, have you looked on the Console when the error occurs to see if there are additional messages? – Hogstrom Nov 3 '18 at 1:01
2

This worked for me:

  1. Shut down Mail, then the entire System
  2. Hold ⌘-R while rebooting to start in Recovery Mode
  3. Once booted, choose Terminal from the Utilities menu
  4. Enter csrutil disable then /sbin/shutdown -r now
  5. Wait for the system to reboot
  6. From Terminal, move your Mail folder to a safe place: mv ~/Library/Mail ~/Desktop
  7. Start Mail and verify all is good
  8. Follow steps 1 though 5 above except in Step 4, enter csrutil enable
  • Thanks so much. This worked perfectly for me. Exchange corrupts my Mail so often that I'm going to leave SIP off. – bmauter Nov 5 '18 at 15:15
  • Rather than disabling SIP system-wide, I believe you could add Terminal.app (or iTerm or whatever terminal program you are using) to System Preferences > Security & Privacy > Privacy: "Full Disk Access". (This is what I did just now when bit by find . throwing such Operation not permitted errors in iTerm.) – Richard Michael Jul 5 at 18:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.