Delete “Ghost” Accounts in Mail on OS X

I recently moved my website to a new host. As part of this, I also moved email accounts. While I was carrying out the move, I maintained two sets of accounts (I have accounts with several domains), but after the move, when I tried to delete the old accounts, I was unable to remove two of them. Not only could I not remove them in Mail, but they don’t show up in the Internet Accounts preference pane.

I scoured the web, and Apple’s support website, trying to find a solution, but wasn’t able to. One thing that clued me to a fix was a message that told me that I couldn’t delete the accounts because they were used by iCloud.

It turned out that the culprit was iCloud Keychain. I have this activated in the iCloud pane of System Preferences.

Icloud keychain

The problem is that the accounts are considered to be “in use” by other devices. Here’s how you can fix this problem.

  1. Turn of iCloud Keychain in the iCloud pane of System Preferences (see above). An alert will ask if you want to keep a copy of your data on your Mac; choose Keep on this Mac.

  2. Choose Mail > Preferences, and click Accounts. You’ll see the accounts you want to delete. Click one, and then click the – button below the accounts list. You should now be able to delete the account. If you have more than one ghost account, repeat this for the other accounts.

  3. Turn iCloud Keychain on again in System Preferences. If you have to, approve this from another device (another Mac, or an iOS device) that’s linked to your iCloud account.

  4. Go back to Mail. In my case, after the iCloud Keychain synced to my Mac, the accounts showed up again. But this time, I was able to select them and delete them, as in step 2 above.

You may have to repeat this on other devices to be able to remove the accounts from those devices.