I like partitions. Got a bunch of ’em on my laptop: several smaller ones, and a large one for data. It’s an easy way to test different OS versions.
Easy, at least, until the OS started taking up so much damn space! Now, I regularly fill up the smaller partitions. One solution is to resize them, an issue I’ll get to later.
But another solution is to move the large personal data stores that are normally replicated on each OS partition to the data partition, where they belong.
For example: my email. Mail normally stores its data in
But I’m never prompted where I want to put this Account Directory, it always defaults to
~/Library/Mail, and as you can see, it’s dimmed, so I can’t change it in the user interface once the account has been created. Well, there may be a way, but it probably involves throwing away all the messages I already have, which I don’t want.
All the information on my accounts is stored in the plist file at
~/Library/Preferences/com.apple.mail.plist. Ah, that’s easy, I think to myself, I’ll just open that file in a text editor and I’ll….
Bzzzt! (Notice how I like that word?) The plist is in binary format: I wouldn’t recommend trying to modify it with TextEdit.
For this, I’ll need to open the plist file in Property List Editor, which is available, after an Xcode Tools install, at
/Developer/Applications/Utilities/Property List Editor.app.
I use the "Dump" button in the upper right-hand corner of the Editor window to get a dump of the plist file as text, and then copy that text to TextEdit (or a better editor such as BBEdit) and save it off somewhere.
Now, I need to search on every instance of
~/Library/Mail/ in that file, and change that path to the new path I want,
/Volumes/Data/Mail/. The primary location for this in the plist is: MailAccounts → <account dictionary> → AccountPath.
What’s surprising is that this isn’t the only location where I find that path. In fact, it seems that the full path in the file system to the account directory is what’s used to refer to that account throughout the plist. I make sure to change them all.
The plist also contains the path
~/Library/Mail Downloads. I change that to
/Volumes/Data/Mail/Downloads, just to keep all my Mail data in the same
Now that I’m done with the find-and-replace steps, I close Mail and back up all its data. Very important!
Next, I go to the
~/Library/Mail folder. I find the folder called
Mailboxes, if it exists, and copy it to the new location.
I find every folder of the form
ACCOUNTTYPE is IMAP or POP, etc., and
account.domain.com is your incoming mail server, and copy them over as well. I don’t copy everything in
I copy the
~/Library/Mail Downloads folder into the new
Mail folder, and rename it just
Downloads, to match what I specified in the new plist, above.
Finally, while Mail still is closed, I replace the old binary plist (which I also backed up) with my newly edited, text plist. I say a little prayer, and reopen Mail.
Finally, once I’m sure everything is working, I get rid of the Mail folders on my OS partition. I follow all the same steps as listed above for my other OS partitions (except for populating
/Volumes/Data/Mail, which I do only once with the most up-to-date data), and I’m done.
Feedback #1 If all I have is IMAP accounts, why not just go ahead and never store anything locally? Problem solved!
For one, IMAP is slow enough as it is: if I have to download all my messages from the server every time I open Mail, it’ll go even slower! For two, Mail tells me it won’t be able to check for spam under that configuration, though I haven’t verified this.
Feedback #2 If you do steps X, Y, and Z, you can get that widget to activate, and move the storage. Why not just do that?
As I said above, there may be a way to change the Account Directory value in the UI, but I suspect it only lets you do that if you empty your local storage, which I don’t want to do. If you do find some other series of steps that don’t have that drawback, let me know!
Also, remember that
Mailboxes folder I moved? That holds all the local mailboxes I made, via Mailbox→New Mailbox…. I can’t move that to my central location without delving into the Mail plist as I’ve described above.
Update: There are a couple of good comments that describe both simpler and yet more all-or-nothing solutions than the one I proposed. Have a look!
Also, I originally advised moving the folder
Icons, but it’s both not where I said it was, and you shouldn’t move it. It’s not at
~/Library/Mail/, it’s just at
~/Library/, and that’s a good thing, because the icons are used by more than one application. So leave ’em there!