Saturday, September 5, 2009

Steps to replace an old mac

Disclaimer: doing the following steps requires that you have some knowledge about Macs. Do these steps at your own risk. I used Mac OSX Leopard, maybe your system is different and will not work for you, I take no responsibility about your data loss.

I got a new MacBook pro laptop, and usually a new task comes with a new computer is to set it up. I had my old laptop, and I just wanted the new one to work in the same way as the old one. The first tool which is handy in case, is the Migration Assistant.

Migration Assistant

This program be found in /Applications/Utilities. You have to have a firewire cable and you have to boot your old mac in target disk mode. Here is how you can do that. I set it up to copy everything including all settings and all possible users. Unfortunately it cannot handle File Vault users, so I had to do it manually later. For me it worked for about 3 hours in the background (I could use the computer in the meantime), and after that, a lot of things were copied, including network settings, my MacPorts installation (in /opt/local), all of my non-encrypted local files (music, shell scripts, etc.), even my Hungarian Plus keyboard layout, which lies in /Library/Keyboard Layouts.

You can do anything during the copy, but make sure you don't do any permanent changes in your home directory if it is file vaulted, since you'll overwrite everything soon with your old home directory.

Copying a File-Vaulted user

I had a file-vaulted home directory, and this is not copied by the Migration Assistant, so I had to copy it manually. If you don't have file vault or don't want to copy it, you can skip this step.

Given that the old computer's disk is called Macintosh HD, and the old computer is in Target Disk mode, then your file vault home directory is in the Macintosh HD/Users/.username or Macintosh HD/Users/username . Note, that there are two Macintosh HDs, the remote computer is the one which has an eject button next to it, and this is what you need now.

You cannot see the files in Finder which starts with a ".", but you can navigate to the parent folder and press Cmd+Shift+G, and then enter the directory name, and it jumps into it.

Copy the username.sparsebundle file to your local computer somewhere outside to your home directory, for example in the root directory of your new computer (Macintosh HD).

When it is finished, you'll need to have another administrator user. If you don't have one, create it in the Account Preferences.

You can detach your old computer now, or if it is not finished with the Migration Assistant, wait for it, and detach it after.

Log out with your current user and log in with your other admin user. It is very important to log out with your user, not just use fast user switch, because we'll overwrite the user's home directory.

Find where is your main user's home directory, it should be in Macintosh HD/Users/username (or maybe .username, but it is usually happens only when you forgot to log out with that. Check if you are logged out properly before continue).

Assuming you copied your old sparsebundle to Macintosh HD, you have to do the following in terminal to have your old home directory replace your current one (replace username to your short username):
cd /Users/username
mv username.sparsebundle username.save.sparsebundle
mv /username.sparsebundle .
Now you are ready, and you are able to log in to your old environment in your new laptop!

Registered software, iTunes

We're almost ready, but some registered software requires a new registration, since you use them in a new computer. Check your Applications directory and re-register your software if you don't want surprises after some weeks when you try to launch your favorite but rarely used software out in the wild without internet and with no access to your registration numbers.

iTunes also requires you to register your new computer in iTunes store to listen to your audio and watch videos you bought. There is a menu item for that: Store/Authorize computer.

Time machine

Time machine will think that it is a totally brand new computer (which is actually true), and it will start backing up your system entirely into a new space. This is probably not what you want. If you want to continue using this new computer as you used your old one, it would be convenient to save to the same place as the old computer, and archive only the differences.

I've found a good tutorial about how to make it work here. The only addition to this that if you use a remote backup (not to mention remote encrypted backup), then the referred file which starts with a "." will be in a different directory: It will be in the folder which stores the sparsebundles, not in the directory where Backups.backupdb is in. After that, you also have to rename the sparsebundle file to match your new mac address. But other than that, that document fully applies and worked for me.

That's it!

Those steps seems to be necessary and enough to copy and set up everything the way it was in my old laptop. Double check that you have everything in your new computer, and then you can start to wipe everything from your old computer and give it to your daddy, your wife, sell it, etc.

No comments:

Post a Comment