Everything In Between

If your project so much as pretends to have a profit motive, I will tell you to go fuck yourself and your project.

Moving personal data from one Mac to another

8 comments

I recently purchased a new iMac. It’s aluminum. And glass. And shiny. And it’s so much faster than my old G4 workstation I feel a little bit like I’ve just come out of the stone age.

Anyway, the experience of moving one’s data from one machine to another is always a bit of a hassle. There are so many little things you’re sure you’ve forgotten, preferences you don’t want to have to recreate, and small gotchas that, if you’re not careful, will mean you’ve lost something like your old email or your contacts—sometimes for good.

Thankfully, with a remarkably few easy planning steps, a lot of this trouble can be avoided all together. Much of this is thanks to the brilliant architecture of Mac OS X, which does a superb (though not perfect) job of separating data from applications. The other major benefactor of this kind of easy transition is server-based data stores, or hosted services (even if those services are ones I’ve hosted myself).

So here’s what I wanted to move over from my old mac to my new one:

  • Personal documents, pictures, movies, and music, etc.
  • Preferences for all applications, such as my dock layout, the Finder’s and Mail’s toolbar button arrangements, and so on.
  • PIM databases, such as my Address Book contacts, iCal calendars, my email, and the like.

This could really be a much longer list, especially if I were going to name every single item of personal importance. Nevertheless, each item falls into one of these three main categories of stuff that I want to move.

The first time you turn on a new Mac it will ask if you want to transfer your data from your old computer to your new computer. It does this using the Migration Assistant application located in your Mac’s /Applications/Utilities folder. While this works well for the most part, I’ve seen this program fail one too many times—especially for cross-architecture, PPC to Intel, transfers—that I’m simply not a fan of using it. Besides, as you’ll see in a moment, it’s trivially easy to do all of that yourself.

Of course, all of your personal information should be somewhere in your Home folder. You could just copy the entire directory from one Mac to the other, but you’ll probably end up deleting some (albeit probably non-critical) items from your new machine. When you drag-and-drop in the Finder, the Finder first removes anything of the same name on the destination as the source of the transfer. This is not what you want.

So here’s how I dealt with moving each type of item, after ensuring I had a good backup:

Transferring personal documents

rsync is a godsend for any situation where you want to ensure that you’re copying files from one location to another. It compares the contents of folders and, by default, only adds missing items to the destination while leaving everything else alone. It also overwrites identically-named files on the destination with files from the source.

To use rsync, I first needed to turn on the destination Mac’s “Remote Login” feature; this turns on the SSH server. (Find this in System Preferences → Sharing → Services.) Next, simply issue this relatively simple command at the command line, from your home directory:

rsync -aEve ssh Documents UserShortName@DestinationMac:Documents

This tells rsync to copy files from the local machine’s Documents directory to the DestinationMac‘s Documents directory in archive mode (the -a option), which preserves numerous file meta-data such as its modification times and access permissions, along with the file’s extended attributes and resource forks, if any exist (-E), reporting verbosely (-v) as it does so, executing over SSH (-e ssh). The UserShortName is the DestinationMac‘s user short name, obviously, and the DestinationMac is either its hostname (such as mynewmacintosh.local) or its IP address (such as 192.168.0.2).

I repeated the above step for the Desktop, Movies, Music, Pictures, Public, and Sites folders. Most of my music is actually on an external hard drive, so that was of course a cinch, and rsync took care of the rest.

Transferring preferences

Mac OS X stores its user-specific preferences in each user’s home Library/Preferences folder. The set up is elegant and beautifully implemented. Just like the folders above, I could have simply rsync‘ed my preferences over, but I wanted to be more selective. So I simply scrolled through the list finding the preference files for the applications I still use and copied them over. I used the Finder’s drag-and-drop, but you could use whatever method you want.

These files are named in reverse-DNS style notation, so for instance, my Mail preferences were stored in the file com.apple.mail.plist.

This was a super-simple step.

Transferring PIM databases

Like preferences, user-specific data is often stored in that user’s home Library/Application Support folder. Inside that folder is a folder for each application that has some data to store. All of iCal’s information, for example, is thus stored in your home Library/Application Support/iCal folder.

rsync to the rescue again:

rsync -aEve ssh Library/Application\ Support/iCal "UserShortName@DestinationMac:Library/Application\ Support/iCal"

In this case, because of the space in the Application Support folder’s name, the quotations and the backslashes are required to help rsync find the proper folders. Other than that, the command is the same as before.

I selectively copied over all the data from the applications I wanted to keep and, voila, the next time I opened iCal or Address Book, my data was there.

The Mail application and Safari both have special ways of handling their information, however, so their datastores couldn’t be found in the Application Support folder. Instead, they keep their folders directly inside the Library folder named (predictably) Mail and Safari, respectively.

Also, since I use IMAP for email and shared calendars in the form of .ics subscriptions whenever possible, the natural sync process for these databases saved a lot of time.

Most other programs in non-standard locations could be found with a little digging inside my Library folder.

It should be noted that for this to work reliably, you should always move all the preference files along with the Application Support directory for any program whose Application Support directory you’re grabbing!

Cleaning up

All told, the whole thing took maybe two hours and most of that time was spent transferring data. It was really quite painless. Because this was a surgical transfer, instead of a full “migration,” there’s very little to clean up.

However, for some reason, Apple’s .Mac Sync service had quite a bit of trouble keeping up with my new Mac’s new additions. The fix was simple enough: unregister every sync’ed computer, then reset all of the .Mac Sync data with the data on the new Mac. Then, re-sync each device either merging its data during its syncing process or replacing the data on it with the new, known-good data on .Mac. (Again, make sure your backup works before you do this.)

And that’s pretty much it. Now I have a new iMac, but it looks exactly like my old one on the screen. :)

Written by Meitar

September 13th, 2007 at 1:26 pm

8 Responses to 'Moving personal data from one Mac to another'

Subscribe to comments with RSS or TrackBack to 'Moving personal data from one Mac to another'.

  1. Yay, you have a shiny new computer!

    S

    13 Sep 07 at 2:23 PM

  2. Well, Big thanks here. This is really helpful. But then again, you’re a (mac) genius.

    nick

    16 Sep 07 at 5:40 PM

  3. Yay, I have a shiny new computer. :)

    Meitar

    17 Sep 07 at 10:28 AM

  4. No worries. I’m very thankful that I finished the transfer when I did because the next thing I knew my old computer’s hard drive crashed hard and completely stopped working. My most recent backup was three days prior, so it wouldn’t have been a major loss but it would have been an even bigger nuisance than losing a hard drive already is.

    Meitar

    17 Sep 07 at 10:30 AM

  5. Does anyone know if this changes the permissions/owners of the files/directories copied to the external machine? I frequently use the scp -rp command to send files back, and forth between machines, but would love to utilize the rsync command as well. The scp command works very similarly to this function, and the -rp is to change permissions for the files/directories being copied. I would love to know if the owners/permissions are changed for the external machine once the sync is complete.

    billgz

    26 Dec 07 at 8:20 PM

  6. Bill, rsync‘s -a option stands for “archive mode” which means that it will preserve as many file attributes as it can during the transfer, including its owner, group, and permissions. Though I haven’t tested this, I believe that if you don’t tell rsync to preserve permissions in this way, then after you sync your files will be owned by the user you’re logging into the destination machine with.

    Meitar

    26 Dec 07 at 11:50 PM

  7. Okay now for the “dumb” questions before I launch into transfer of data on my own:
    1) will data (all of it incl applications) remain on my older computer;
    2) will my email addresses incl the ones that pop up automatically but that may not be in my address book be retained on new computer;
    3) must all data be on the hard drive or can I transfer items found in folders on the desktop?

    I thank you and hope you’re still at this site (last posts 2007).

    poetSantaFe

    11 Jul 09 at 12:50 PM

  8. @poetSantaFe:

    will data (all of it incl applications) remain on my older computer;

    A “transfer” is really just a copy. So, yes.

    will my email addresses incl the ones that pop up automatically but that may not be in my address book be retained on new computer;

    I don’t know what you’re referring to by “ones that pop up automatically but that may not be in my address book.” Sorry.

    must all data be on the hard drive or can I transfer items found in folders on the desktop?

    Um, folders on the desktop are almost certainly going to be on your local hard drive.

    To be blunt, your questions make it sound like the best option for you is going to be the Mac OS X Migration Assistant, which is what appears when you turn on your new Mac for the first time and asks if you want to transfer your data. Seriously, just say yes and follow the on-screen instructions. Don’t bother with rsync if you’re not already very familiar with the Terminal application.

    Meitar

    11 Jul 09 at 1:01 PM

Leave a Reply