Create an up to date image of OS X Lion 10.7 Using InstaDMG

instadmg mac lion osx 10.7 bootable image

InstaDMG OSX 10.7 Lion Boxed Image

This is an introduction to InstaDMG, which is a powerful command line tool used to produce clean never booted OS X images, these images can include OSX incremental upgrades as well as 3rd party software and scripts.

This particular guide is a reference to getting started and just produce an up to date OSX 10.7 image with incremental upgrades applied, a later guide will introduce some more complex topics including adding 3rd party software and computer specific settings.

The first task  is to download the InstaDMG code which is stored on Google you can view those files here http://instadmg.googlecode.com/svn/trunk/. The actual installation is done via Terminal.

Installing InstaDMG

This all works through the command line interface as there is no GUI layer for InstaDMG  yet, so launch Terminal from Applications > Utilities > Terminal and change into your home directory and download the InstaDMG code using the ‘svn checkout’ command.

svn is Subversion and is an Open Source version control system for managing evolving code and its built into OSX. The command below put you in your home directory and will download the code and create a folder in your home directory called ‘InstaDMG’, you can name this folder anything you like and note that it is presented as an option after the main command if you do not add the option the files will be located in a directory called ‘trunk’ (which can be renamed).

 cd ; svn checkout http://instadmg.googlecode.com/svn/trunk InstaDMG 

Running the command will download and install the required files, the last of the file downloads will have output from the Terminal similar to below :

A trunk/Documentation/InstallerChoices/README
A trunk/Documentation/InstallerChoices/10.6_InstallerChoices.xml
A trunk/Documentation/README
U trunk
Checked out revision 426.

InstaDMG is constantly updated to deal with the OS X updates from Apple. To download the latest version of InstaDMG all that is needed is to move into the installation directory where InstaDMG lives and run a ‘svn’ update, so for example if the install directory is “InstaDMG” and in your home directory you would run:

[~]: cd ~/InstaDMG/
[~/InstaDMG]: svn update
At revision 426.

Here there is no updated files and the revision is stated at 426, any updated files downloaded would be named and a higher revision number will be declared. Curent revision is at 450 and includes incremental updates to OS X 10.7.4.

Preparing the Base OS X 10.7 Image

After the InstaDMG is downloaded the next step is to make a base installation image of OS X 10.7, this has been done in the past through the generic installer disks of OSX, but since OSX 10.7 Lion is diskless it poses a slight problem.

The solution is to extract the InstallESD.dmg from the Lion.app after it is downloaded from the App Store and before it is installed, as when it is installed the app is then deleted – this shows how to reveal the InstallESD.dmg and also a guide to burn a generic copy of 10.7 to disc.

If you have the InstallESD.dmg from Lion just put/copy it in the path below and move onto the next section:

InstaDMG/InstallerFiles/InstallerDiscs/InstallESD.dmg

If for some reason you have a disk and want to import it the traditional way in InstaDMG, pop in the disk let it mount in the finder then in the Terminal cd into your InstaDMG and run the import command as below with “sudo”, it needs to be imported as burning images straight from hard disk is a lot faster than from optical disk.

[~]: cd ~/InstaDMG/AddOns/InstaUp2Date/

[~]: sudo ./importDisk.py --automatic

This will take a bit of time, also make sure no other disks or external drives are mounted as this may produce an error – what you should end up when finished is a “MacOS X Client 10.7 11A511.dmg” filed in this path:

InstaDMG/InstallerFiles/InstallerDiscs/MacOS X Client 10.7 11A511.dmg

Getting The Image Up to Date

Next up and final in one command is to download the OS X incremental updates and produce a fresh generic up-to-date, fully patched, vanilla OS X 10.7 Image. This done through the catalog file which is stored in

InstaDMG/AddOns/InstaUp2Date/CatalogFiles/10.7_vanilla.catalog

and the command to run is back in the InstaUp2Date folder, change directory to there, then run the command as below:

[~]: cd ~/InstaDMG/AddOns/InstaUp2Date/

[~]: sudo ./instaUp2Date.py -p 10.7_vanilla

The actual catalog file you run depends on what type of hardware you have – there are a couple of flavours – you need to run the one the most appropriately suits your hardware, in this instance a generic 10.7 build is being used. The .catalog extension does not need to be added in running the command.

The OS X incremental updates are downloaded and stored on your local drive, future builds will only pull down new updates. After the updates are downloaded they are applied to the original mounted MacOS X Client 10.7 11A511.dmg image and in turn an up to date image is spat out in the directory – “~/InstaDMG/OutputFiles” named “10.7 Vanilla.dmg” which is the all-encompassing new master image.

The initial output in the terminal when the above command is run looks like this:

[~/InstaDMG/AddOns/InstaUp2Date]: sudo ./instaUp2Date.py -p 10.7_vanilla
Password:

Parsing the catalog files for 10.7_vanilla
OS X Lion Update 10.7.1
Java For Mac OS X 10.7
Remote Desktop Client 3.5.1
iTunes 10.4

Finding and validating the sources for 10.7_vanilla
OS X Lion Update 10.7.1 - found based on checksum and verified in 2 seconds
Java For Mac OS X 10.7 - found based on checksum and verified in 2 seconds
Remote Desktop Client 3.5.1 - found based on checksum and verified in less than one second
iTunes 10.4 - found based on checksum and verified in 8 seconds

The final output at the tail of the command will be like this:

19:55:14 ###### Correcting some generic installer errors ######
	Correcting symlinks that point off the disk
	Closing programs that have opened files on the disk
	Deleting Extensions.mkext cache file
	Deleting cache files created during installations
21:38:18 ###### Creating the deployment DMG and scanning for ASR ######
	Rename the deployment volume: Macintosh HD
	Create a read-only image
	Scanning image for ASR: /instadmg/OutputFiles/10.7 Vanilla.dmg
	ASR image scan complete
21:50:17 ###### InstaDMG Complete ######
21:50:17 ###### Cleaning up ######
	Ejecting images
	Deleting scratch DMG

Done

And there you have it one OSX 10.7 image ready for deployment, which can be used in any deployment method including ASR, DeployStudio or as a NetBoot image.

To add a new user pre-image build and clear the Apple Registration screens on boot up – part 2 may be of interest.

To customise prefs and computer settings – check out part 3.

 

Related posts:

  1. Create an updated image of OS X Lion 10.7 with a Local User Account using InstaDMG
  2. OSX Lion InstaDMG First Boot Part 3
  3. Easiest Way to Make an Image or USB bootable Copy of of OSX Lion 10.7
  4. How to make a bootable OSX 10.7 Lion Disc or Drive from the downloaded Lion.app
  5. Make a Bootable USB Drive from OS X Lion Using the Recovery Partition
  • Anonymous

    Great article! One tip, you forgot to mention before running importdisk.py to make sure to mount InstallESD.dmg or it wasn’t clear. After doing that it’ll import it just fine into InstaDMG

  • Kurt Tappe

    Good article. It helps simplify wrapping one’s head around InstaDMG, since there are so many options and it’s not immediately obvious to the beginner that it’s actually the “AddOn” InstaUp2Date that they want to use. Several tips:
    * Warn how long it takes to create the Vanilla image. Anyone not expecting it to take an hour might not realize that. It’s especially disconcerting when one runs “top” and sees several of the processes are listed as “stuck” when in fact they’re working just fine.
    * Stress that a Lion image must be made on a Lion-running Mac. I initially tried to make a Lion Vanilla image under Snow Leopard and it fails; InstaUp2Date requires the Lion versions of several of the Unix tools.
    * Suggest a Mac with 8Gb of RAM and an SSD; InstaUp2Date is highly I/O- and memory-intensive.
    Hope these help!
    (PS: hkim823, I did not have to mount InstallESD; the tools do that for you. Not sure why you had to do that.)

  • blackwire

    First of all thank you for the Good tutorial.Question: Isn’t it still necessary to put the packages in an numbered Folder structure?This has not been mentioned in the text and also on picture 5 “build-firstboot-package” (Part 3: Making the Package with PackageMaker) it is plain to see that there is no such structure.

    • http://coolestguyplanettech.com Neil Gee

      Hi, no it is not necessary – the organisational element is really in the catalog files

  • Dgarsys

    Running a 10.7.3 MBP laptop – every time I try to run InstaUp2Date.py I end up with checksum errors and it never completes. ESD .dmg is copied into the directory listed in the instructions above, the latest version of InstaDMG is downloaded via SVN.

    • http://coolestguyplanettech.com Neil Gee

      reboot and ensure no other external disks are mounted