dmgutil

dmgutil is a command line tool for creating, configuring, and compressing Mac OS X disk images for distribution.

dmgutil allows you to automate your build process, preparing a release without pre-existing templates or user interaction.

dmgutil can adjust the size, position, and appearance of Finder windows. It can also apply custom icons to volumes, folders, or files and assign a license agreement.

Using dmgutil

To create a new disk image for your "MyApp 1.0" release, invoke dmgutil as:

dmgutil.pl --open --volume="MyApp 1.0" myapp_1.0.dmg

Once the disk image has been populated with files, invoke dmgutil to configure it:

dmgutil.pl --set --iconsize=128 --background=flowers.jpg "/Volumes/MyApp 1.0" dmgutil.pl --set --x=20 --y=60 --width=300 --height=200 "/Volumes/MyApp 1.0"

You can also use dmgutil to set the position of file or folder icons within the window:

dmgutil.pl --set --x=100 --y=100 "/Volumes/MyApp 1.0/Read Me.rtf" dmgutil.pl --set --x=200 --y=100 "/Volumes/MyApp 1.0/MyApp.app"

dmgutil can also adjust the background color or toolbar visibility of the window, and apply custom icons to the volume or its contents.

Once the volume has been prepared, compress the disk image with:

dmgutil.pl --close --volume="MyApp 1.0" myapp_1.0.dmg

By invoking dmgutil from a post-build shell script, builds can be automatically converted into a user-friendly disk image for distribution.