Installing OS 10.5 Leopard with a firewire drive and a DMG

Preface: I use my Macs for Photoshop, which I need frequently for image manipulation/creation beyond the abilities of GIMP http://www.gimp.org/ . I also find CSS work in general easier with the Mac and accessing /editing content in SharePoint / MOSS folders is actually pretty easy so creating custom Master pages etc is a relatively smooth process.

The problem: I experienced an AWFUL lot of difficulty in getting to a functional version of 10.5 on my iMac G5 recently. Why? Because I made a DMG of the install disk and promptly lost the original. Duh. These are the steps I took to install from the DMG. Hopefully somebody will find this if they need it and avoid the pain I had.

  1. Restore the DMG to a partition on the Firewire drive.
  2. Copy OSInstall.mpkg to another location.
  3. XAR the copied OSInstall.mpkg and BBEdit the Distribution file inside.
  4. XAR it back and overwrite the original on the Firewire drive.
  5. Change boot drive and install.

First of all, just like anything I do with STSADM, put it all in a text file. That way you can just cut and paste and save yourself a fair amount of time and agravation when needed.

1: Restoring to the Firewire drive

  1. Open Disk Utility application from Applications -> Utilities.
  2. Click on the Restore tab.
  3. Drag the DMG file “Source” field or browse to it.
  4. Drag the icon of the partition (from the left pane) you want to put the installer on to the “Destination” field.
  5. Check the “Erase Destination” check box.
  6. To be safe check the Checksum box.
  7. Click Restore.
  8. Wait.

If you get device busy errors or something else just reboot and try again. Should take about 10 minutes (depending on your hardware.)

2: Getting XAR

  1. Download xar (tar and gz file).
  2. Expand the tar.gz file and open terminal and cd into its directory.
  3. Issue the folowing commands, pressing Return between each one and then waiting for its completion (Developer Tools required):
    $ ./configure
    $ make
    $ sudo make install
  4. Check that the install is in the right location (/usr » local » bin » xar) by issuing which xar; it should return the aforementioned location.

Now here is where the first handbasket from hell appeared. MAKE errored out with the following

ld: Undefined symbols:
_xmlDictCleanup
/usr/bin/libtool: internal link edit command failed
make: *** [lib/librxar.1.dylib] Error 1

This is a specific issue with XAR 1.52.

The Fix: 1.5.2 seems to be missing the #define xar from lib/archive.c:

#if LIBXML_VERSION <>
#define xmlDictCleanup() /* function doesn’t exist in older API */
#endif

Save yourself some pain and add that code in blue above in. MAKE should work just fine now.

3: Working with OSInstall.mpkg: Do this if you need to force the installer to bypass some checks such as for older hardware. The risk is yours if you do as they say…

  1. Copy the OSInstall.mpkg to the desktop. For 10.5, the package we need is in /System » Installation » Packages/ folder on the drive with 10.5.
  2. Go into Terminal and cd to the folder you put the mpkg in, then issue the following command to decompress the mpkg to the folder:
    $ /usr/local/bin/./xar -x -f OSInstall.mpkg
  3. Go into the OSInstall folder, and you’ll see a Distribution file and Packages folder.
  4. Open the Distribution file in a text editor, for example I use BBEdit. It’s an xml script, so you can just edit it. Look for minRam and the processor speed requirments, and change these, and any other options which could prevent install on your setup. Save the changes.
  5. Issue the following command to compress the files back into xar’d mpkg file:
    $ /usr/local/bin/./xar -c -f OSInstall.mpkg *.
  6. The OSInstall folder should now have a new OSInstall.mpkg file in it. We then need to copy this new file into /System » Installation » Packages folder on the drive with 10.5. Firstly I’d rename the existing OSInstall.mpkg so we have a copy of it, so cd into the /System » Installation » Packages folder on the drive with 10.5, and issue the following command in Terminal:
    $ sudo mv OSInstall.mpkg OSInstall_orig.mpkg
  7. We then need to copy over the new package, so issue the following command in Terminal:
    sudo rm "/Volumes/Mac OS X Install DVD/System/Installation/Packages/OSInstall.mpkg"
    sudo mv OSInstall.mpkg "/Volumes/Mac OS X Install DVD/System/Installation/Packages/"


4: Change the Startup Disk

Now that all remains is to go into the Startup Disk preference pane and select the drive you copied/restored 10.5 to, boot from that drive, and you should then be able to install without issues.

This may be useful too: http://coreboarder.com/blog/?p=231