How to fix macOS Mail when mailboxes aren’t in alphabetical order

macos sierra mail icon

Steve Price wrote in with a question about alphabetic sorting of macOS Mail’s mailboxes, and then, shortly after, a solution! (Which is always welcome, dear readers, as I can then share them widely with others).

mac911 disalble mail account

Disable accounts before deleting the cache files.

Steve followed Chris Breen’s advice at Macworld in 2014 about alphabetizing his mailboxes, but it didn’t work. The mailboxes were in A to Z order at iCloud.com, however. He dug around in forums, found a solution, tried it, and it worked. I’ve modified and expanded on his advice.

If you’re using IMAP and have all your messages stored on a remote server, you shouldn’t be able to delete those messages through this process. If you have locally stored mailboxes, make sure they’re archived via Time Machine or other backup software.

  1. In Mail, use Mail > Preferences > Accounts to select and disable (uncheck the Enable This Account box) for whichever account you want to fix mailbox alphabetization.
  2. Quit Mail.
  3. In Terminal, type cd ~/Library/Mail/V4/ and press Return.
  4. Figure out which directory corresponds to the email account you want to delete (see below).
  5. Type cd plus a space plus a few letters of that directory and then press Tab to fill in the rest. Press Return.
  6. Now type rm .mboxCache.plist and press Return.
  7. In each .mbox directory, you need to delete a file named Info.plist. You can either do this by typing cd plus the mailbox name (or first few characters and press Tab), then Return, then rm Info.plist.
  8. Empty the Trash.
  9. Launch Mail and re-enable the account or accounts in question.

To figure out which directory or folder corresponds to the account you want to fix, you need to look at the mailboxes inside and see how they match the ones in Mail. In earlier versions of Mail, each folder was named distinctively with the account name, which I still have for one of my accounts.

mac911 delete cache mail alpha

With some Terminal magic, you can make your Mail account’s mailboxes alphabetically sort again.

For step 7, above, you can also use the Finder:

  1. Select Go > Folder.
  2. Enter ~/Library/Mail/V4/ and press Return.
  3. Open the folder that corresponds to your account (as determined in step 4 above and instructions below).
  4. For each mailbox folder, click the expand triangle next to its name and then delete Info.plist.

You can streamline step 7 if you’re very comfortable with the Terminal and also can cope with recovering files if you make a mistake. If you make a mistake, you could delete many files. While within the account directory in Terminal you determined in step 4 above, copy and paste the following command, which looks into every directory below the level you’re at and deletes the Info.plist file if found. It prints out a line for each file it deletes.

find . -name Info.plist -print -exec rm {} \;

You can test the command by omitting everything after -print, and it will preview which files would be deleted.

Ask Mac 911

We’ve compiled a list of the most commonly asked questions we get, and the answers to them: read our super FAQ to see if you’re covered. If not, we’re always looking for new problems to solve! Email yours to mac911@macworld.com including screen captures as appropriate. Mac 911 cannot reply to email with troubleshooting advice nor can we publish answers to every question.

To comment on this article and other Macworld content, visit our Facebook page or our Twitter feed.
Shop Tech Products at Amazon
Notice to our Readers
We're now using social media to take your comments and feedback. Learn more about this here.