[robg adds: With the newly-announced Panther ship date (what, you haven't visited apple.com yet today?), this information may be particularly useful in the near future for upgrades, not just corruption recovery. Read the rest of the articles for the details, and feel free to comment with the tips and tricks that you use when upgrading a machine...]
Get the software you need.
- First you need to find a 10.2 Install disk, not a 10.2 upgrade disk. The difference is that starting with 10.2, the install disk has an option called "archive and install."
- Since this is going to backtrack your system to 10.2.0, you want have handy a copy of the combined 10.2.0 to 10.2.6 updater
- Optionally if you use the Developer tools, I recommend getting a fresh copy of the Developer Tools install.
- Optionally if you use X11, I recommend getting a fresh installer
The Re-install.
- First to avoid hang-ups, be on the safe side and boot from the install CD and run Disk Utility's Restore Priviledges program. After the system boots from the disk, you can find this located in the menu.
- Run the install program. When you get to the screen asking for the destination disk, it should warn you that you cannot do a normal install. Whether it does or does not warn you, choose the install options button and select the "archive and install" mode. Now you can do the install normally. This mode preserves all user folders in their current places (except for the shared folder, which is saved but moved to a holding place). The system, usr, bin, private, var, logs, and Library folders will be moved to a holding place and replaced with virgin ones from the install disk.
- Notably you do not need to write down any special information like your IP address, as will not be asked for you network settings and the usual first time install questions; these are all preserved.
- After the install has run (during which you will have to reboot once from the hard disk during the install process and insert the second install disk), you should now run the Combined Updater you downloaded earlier.
- Optionally, you can now install the Developer Tools and X11.
- Now run Software Update (in the System Prefs). Run this, reboot as needed, and then re-run it again. Repeat this until no more software updates appear to be available.
- After the updater has run, and you have rebooted, once again run Disk Utiltiy and restore your privledges; this time you want to do it booted from the hard disk and not the CD.
Actually now we get to the tricky part. Your old configuration has now been saved in a top level folder called "Previous Systems" and inside this you should see "Previous System 1" (assuming this is the first time you did this). This contains some things you need to keep by dragging them back to their original locations, then you can delete the rest. I can only give you some guidelines here, as I don't know what special things you may have installed.
- iTunes! Your "Shared" foder has been moved to the Previous Systems 1 folder. Notably, this could contain all of your iTunes music libraries. So drag these back to the new Shared folder.
- Since you just re-installed the Developer Tools, you can now delete the Previous Systems 1 -> Developer folder. By the way, the reason for re-installing the Developer Tools is because the installation process also places some files in your /bin directories, such as make, and also sets up some aliased file names. The same is true for X11. I feel it's easier to just re-install than to go hunting for these and possibly goof up.
- The Library and the usr -> local folders are where you should now focus your attention. These folders will contain mostly things you don't want to move, but there will be lots of application-specific data, fonts, and system configurations in the Library that you will want to keep. If you have installed custom unix packages (other than those from fink), or possibly some hand-installed perl packages, it's likely they and their man pages will be in usr/local.
- Note that you should be examining these in a UNIX terminal window and not the Finder, since the some of these like private and usr are hidden from the Finder.
As a safety precaution, delete any soft links in the /Previous Systems -> Previous Systems 1 directory (e.g. the private directory is one). This will keep you from making some easy mistakes when the time comes to delete files. At first I tried using a recursive diff, like this,
diff -r --brief /Library /Previous\ Systems/Previous\ System\ 1/Library/
to view the differences (you may wish to run this as sudo). However, this produces a tedious amount of information -- somewhat useful for getting the big picture, but too much to find those key files. Instead, what I did was to write a little perl script to delete any files that appear to be identical to the current ones:
cat > compare.pl
#!/usr/bin/perl -wn
# note the -wn above!
chomp;
next unless -f; # skip if not a file
$y = quotemeta($_); #meta quote the spaces
# Note the following assumes the name of the
# Previous System is in fact numbered 1
$x = '/Previous\ Systems/Previous\ System\ 1/';
$z = '/Previous Systems/Previous System 1/';
# the difference between these lines arises
# from the different ways perl and the system
# parse meta characters in file system commands.
$g = $z.$_; # path to prev system file in perl syntax
if (-f $g) { # skip unless this file exists
# compare md5 checksums of old and new files
$k= `/sbin/md5 $x$y`; # path to prev system file in unix syntax
$j= `/sbin/md5 $y`;
@k1 = split /=/, $k; # get the part after the "=" sign
$kk = $k1[-1];
chomp($kk);
@k1 = split /=/, $j;
$jj = $k1[-1];
chomp($jj);
if ($kk eq $jj ) {print `rm $x$y`};
}
To use this, I select a folder like the Library and run sudo find /Library | sudo ./compare.pl. Warning: executing that line of code will delete files on your computer and cannot be undone. It does what you want but just be aware of this.
Do this in turn on /usr and /bin and /var and so on. Do not run it on symbolic links like /private. After doing this, none of the directories are removed, but any contents identical to the current contents are deleted from the previous systems folder. Thus you can find the fonts you added and the application files. However, there will be lots of junk still there such as all the receipts for the various packages you installed, log files, caches, etc. You just have to wade through this, but now it's a lot easier.
After doing this I was able to get all of my applications running again except for Keynote, which I could never figure out what library files were inconsistent.
Personally, taking advantage of this fresh start, I decided to scap my old usr -> local folder and re-install any custom unix packages. The reason was that I had lots of things that were obsolete and did not want too keep, but found it too hard to reliably unistall from the man pages and so forth.
After completing this, I found that I had freed up gigabytes of disk space that had been chewed up by logs, and obsolete data from various applications I no longer used. Also, my computer booted a lot faster than it used to -- not sure why, but no doubt my system had more cruft than I realized.
References: Useful sources of information:

