An Apple disk image is a disk image commonly used by the Mac OS X operating
system. When opened, an Apple disk image is "mounted" as a volume within the
Finder. An Apple disk image can be structured according to one of several
proprietary disk image formats, including the Universal Disk Image
Format and the New Disk Image Format. An Apple disk image file's name usually has
".dmg" as its extension. An Apple disk image allows secure
password protection as well as file compression, and hence serves both
security and file distribution functions; such a disk image is most
commonly used to distribute software over the Internet.
Overview Apple originally created its disk image
formats because the resource fork used by Mac applications could not easily be
transferred over mixed networks such as those that make up the Internet. Even as
the use of resource forks declined with Mac OS X, disk images remained the
standard software distribution format. Disk images allow the distributor to
control the Finder's presentation of the window, which is commonly used to
instruct the user to copy the application to the correct folder.
Universal Disk Image Format is the native disk image format for Mac OS X.
Disk images in this format typically have a .dmg extension. New Disk Image
Format was the previous default disk image format in Mac OS 9, and disk
images with this format generally have a .img or .smi file extension. Files with
the .smi extension are actually applications that mount an embedded disk
image, thus a "Self Mounting Image", and are intended only for Mac OS 9 and
earlier. A previous version of the format, intended only for floppy disk
images, is usually referred to as "Disk Copy 4.2" format, after the version of
the Disk Copy utility that was used to handle these images. A similar format
that supported compression of floppy disk images is called DART. Apple disk
image files are published with a MIME type of application/x-apple-diskimage.
Different file systems can be contained inside these disk images, and there is
also support for creating hybrid optical media images that contain multiple file
systems. Some of the file systems supported include Hierarchical File
System, HFS Plus, File Allocation Table, ISO9660 and Universal Disk Format.
Apple disk images can be created using utilities bundled with Mac OS X,
specifically Disk Copy in Mac OS X v10.2 and earlier and Disk Utility in Mac OS X
v10.3 and later. These utilities can also use Apple disk image files as
images for burning CDs and DVDs. Disk image files may also be managed via the
command line using the hdiutil utility. UDIF data format
Apple disk image files are essentially raw disk images with some added
metadata, optionally with one or two layers applied that provide compression
and encryption. In hdiutil these layers are called CUDIFEncoding and
CEncryptedEncoding. UDIF supports ADC, zlib, and bzip2
compression internally. = Trailer =
The trailer can be described using the following C structure. All values are
big-endian Here is an explanation:
Support Apple has not released any documentation
on the format, but attempts to reverse engineer parts of the format have been
successful. The encrypted layer was reverse engineered in an implementation
called VileFault. There are few options available to extract files or mount the
proprietary Apple Disk Image format. Some cross-platform conversion utilities
are: dmg2img was originally written in Perl;
however, the Perl version is no longer maintained, and the project was
rewritten in C. Currently, without additional tools, the resulting images
may be mounted only under Mac OS X and under Linux. UDIF ADC-compressed images
have been supported since version 1.5. DMGEXtractor is written in Java with
GUI, and it supports more advanced features of dmg including AES-128
encrypted images but not UDCO images. PeaZip
In Windows, most dmg images can be opened using several other programs such
as 7-Zip, UltraISO, and IsoBuster. MacDrive can also mount simple dmg files
as drives under windows, but not sparse disk or encrypted dmgs. A free Apple DMG
Disk Image Viewer also exists. In Linux and possibly other Unix
flavors, most .dmg files can be burned to CD/DVD using any CD-burner program or
directly mounted to a mountpoint. darling-dmg is a FUSE module enabling
easy DMG file mounting on Linux. = Macintosh =
In Mac OS X v10.2.3, Apple introduced Compressed Disk Images and
Internet-Enabled Disk Images for use with the Apple utility Disk Copy, which
was later integrated into Disk Utility in 10.3. The Disk Copy application had
the ability to display a multi-lingual software license agreement before
mounting a disk image. The image will not be mounted unless the user indicates
agreement with the license. Currently, the only way to open a .dmg
disk image in Mac OS 9 is to use either the developer version of Disk Copy, or a
beta version of the unreleased 6.5. However, both versions can only open
uncompressed images; compressed Disk Images are unusable on Mac OS 9.
See also cloop
DiskImageMounter Installer
Sparse image References
External links Demystifying DMG A detailed discussion
of the DMG file format and mounting it on iOS and Mac OS X
Apple Developer Connection A Quick Look at PackageMaker and Installer
O'Reilly Mac DevCenter Tip 16-5. Create a Disk Image from a Directory in the
Terminal hdiutil(1) – Darwin and OS X General
Commands Manual