Apple Disk Image
Encyclopedia
Apple Disk Image is a proprietary disk image
format commonly used with the Mac OS X
operating system. The format allows secure password protection as well as file compression and hence serves both security and file distribution functions; it is most commonly used to distribute software over the Internet. Universal Disk Image (UDIF) is a flat file format
, and is the native image format
for Mac OS X.
Newly created Apple Disk Images typically have a .dmg extension, although legacy Apple Disk Image files intended for Mac OS 9
and earlier generally have .smi or .img file extensions. Apple Disk Image files are published with a MIME type of application/x-apple-diskimage. When opened, an Apple Disk Image is "mounted
" as a drive within the Finder
.
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. The format can also be opened by MagicISO
and the freeware
MagicDisc on Microsoft Windows
, along with several free software
implementations.
UDIF supports ADC (an old proprietary compression format by Apple), zlib
and bzip2
compression internally.
, Apple introduced Internet-Enabled Disk Images for use with the Apple utility Disk Copy, which was 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 Disk Image in Mac OS 9
is to use either the developer version of Disk Copy
(version 6.4), 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.
implementations include dmg2img and DMGExtractor.
The encrypted layer was reverse engineered in an implementation called VileFault (A spoonerism
of FileVault
), and dmg2img and DMGExtractor have since implemented support for encrypted images. DMG files can be converted into ISO files using software like PowerISO.
There are few options available to extract files or mount the proprietary Apple Disk Image format. The supported features are limited because of the proprietary nature of the format.
The well-known cross-platform and GPL
licensed format 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
(provided hfsplus support has been enabled). 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.
In Windows, most dmg images can be opened using several other programs such as Acute Systems TransMac, HFSExplorer, 7-Zip
, UltraISO
, and IsoBuster
. MacDrive can also mount simple dmg files as drives under windows, but not sparse disk or encrypted dmgs.
In Linux and possibly other Unix flavors, most .dmg files can be burned to CD/DVD using the program cdrecord or directly mounted to a mountpoint (e.g. mount -o loop,ro -t hfsplus imagefile.dmg /mnt/mountpoint).
PowerISO
is a proprietary, cross platform, Freeware CLI tool that runs on Linux
; it can convert most proprietary image formats to ISO, and newer versions support .dmg.
Disk image
A disk image is a single file or storage device containing the complete contents and structure representing a data storage medium or device, such as a hard drive, tape drive, floppy disk, CD/DVD/BD, or USB flash drive, although an image of an optical disc may be referred to as an optical disc image...
format commonly used with the Mac OS X
Mac OS X
Mac OS X is a series of Unix-based operating systems and graphical user interfaces developed, marketed, and sold by Apple Inc. Since 2002, has been included with all new Macintosh computer systems...
operating system. The format allows secure password protection as well as file compression and hence serves both security and file distribution functions; it is most commonly used to distribute software over the Internet. Universal Disk Image (UDIF) is a flat file format
File format
A file format is a particular way that information is encoded for storage in a computer file.Since a disk drive, or indeed any computer storage, can store only bits, the computer must have some way of converting information to 0s and 1s and vice-versa. There are different kinds of formats for...
, and is the native image format
Native and foreign format
A native format, in the context of software applications, refers to the file format which the application works with during creation, edition or publication of a file...
for Mac OS X.
Newly created Apple Disk Images typically have a .dmg extension, although legacy Apple Disk Image files intended for Mac OS 9
Mac OS 9
Mac OS 9 is the final major release of Apple's Mac OS before the launch of Mac OS X. Introduced on October 23, 1999, Apple positioned it as "The Best Internet Operating System Ever," highlighting Sherlock 2's Internet search capabilities, integration with Apple's free online services known as...
and earlier generally have .smi or .img file extensions. Apple Disk Image files are published with a MIME type of application/x-apple-diskimage. When opened, an Apple Disk Image is "mounted
Mount (computing)
Mounting takes place before a computer can use any kind of storage device . The user or their operating system must make it accessible through the computer's file system. A user can access only files on mounted media.- Mount point :A mount point is a physical location in the partition used as a...
" as a drive within the Finder
Macintosh Finder
The Finder is the default file manager used on Mac OS and Mac OS X operating systems; it is responsible for the overall user-management of files, disks, network volumes and the launching of other applications...
.
Apple Disk Images can be created using utilities bundled with Mac OS X, specifically Disk Copy
Disk Copy
Disk Copy was the default utility for handling disk images in System 7 through Mac OS X 10.2 . In later versions of Mac OS X it has been replaced by DiskImageMounter for mounting the images and Disk Utility for creating them.Although the last official public release of Disk Copy for Mac OS 9 was...
in Mac OS X v10.2
Mac OS X v10.2
Mac OS X version 10.2 "Jaguar" is the third major release of Mac OS X, Apple's desktop and server operating system. It superseded Mac OS X v10.1 code name Puma and preceded Mac OS X Panther...
and earlier and Disk Utility
Disk Utility
Disk Utility is the name of a utility created by Apple for performing disk-related tasks in Mac OS X. These tasks include:*the creation, conversion, compression and encryption of disk images from a wide range of formats read by Disk Utility to .dmg or—for CD/DVD images—.cdr, which is identical to...
in Mac OS X v10.3
Mac OS X v10.3
Mac OS X Panther is the fourth major release of Mac OS X, Apple’s desktop and server operating system. It followed Mac OS X v10.2 "Jaguar" and preceded Mac OS X Tiger...
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. The format can also be opened by MagicISO
MagicISO
MagicISO is a CD/DVD image shareware utility that can extract, edit, create, and burn disc image files. It offers the possibility of converting between ISO and CUE/BIN and their proprietary Universal Image Format disc image format.In addition to being able to edit the contents of the disc images...
and the freeware
Freeware
Freeware is computer software that is available for use at no cost or for an optional fee, but usually with one or more restricted usage rights. Freeware is in contrast to commercial software, which is typically sold for profit, but might be distributed for a business or commercial purpose in the...
MagicDisc on Microsoft Windows
Microsoft Windows
Microsoft Windows is a series of operating systems produced by Microsoft.Microsoft introduced an operating environment named Windows on November 20, 1985 as an add-on to MS-DOS in response to the growing interest in graphical user interfaces . Microsoft Windows came to dominate the world's personal...
, along with several free software
Free software
Free software, software libre or libre software is software that can be used, studied, and modified without restriction, and which can be copied and redistributed in modified or unmodified form either without restriction, or with restrictions that only ensure that further recipients can also do...
implementations.
Data format
Files with the extension .dmg are essentially raw disk images (i.e. contain block data), optionally with one or two layers applied that provide compression and encryption. In hdiutil these layers are called CUDIFEncoding and CEncryptedEncoding.UDIF supports ADC (an old proprietary compression format by Apple), zlib
Zlib
zlib is a software library used for data compression. zlib was written by Jean-Loup Gailly and Mark Adler and is an abstraction of the DEFLATE compression algorithm used in their gzip file compression program. Zlib is also a crucial component of many software platforms including Linux, Mac OS X,...
and bzip2
Bzip2
bzip2 is a free and open source implementation of the Burrows–Wheeler algorithm. It is developed and maintained by Julian Seward. Seward made the first public release of bzip2, version 0.15, in July 1996.-Compression efficiency:...
compression internally.
Header
The header can be described using the following C structure. All values are little-endian (Apple II byte ordering)Position(in Hex) | Length (in bytes) | Description |
---|---|---|
000 | 4 | The integer constant '2IMG'. This integer should be little-endian, so on the Apple IIgs, this is equivalent to the four characters 'GMI2'; in ORCA/C 2.1, you can use the integer constant '2IMG'. |
004 | 4 | A four-character tag identifying the application that created the file. |
008 | 2 | The length of this header, in bytes. Should be 52. |
00A | 2 | The version number of the image file format. Should be 1. |
00C | 4 | The image format. |
010 | 4 | Flags |
014 | 4 | The number of 512-byte blocks in the disk image. This value should be zero unless the image format is 1 (ProDOS order). |
018 | 4 | Offset to the first byte of the first block of the disk in the image file, from the beginning of the file. The disk data must come before the comment and creator-specific chunks. |
01C | 4 | Length of the disk data in bytes. This should be the number of blocks * 512. |
020 | 4 | Offset to the first byte of the image comment. Can be zero if there's no comment. The comment must come after the data chunk, but before the creator-specific chunk. The comment, if it exists, should be raw text; no length byte or C-style null terminator byte is required (that's what the next field is for). |
024 | 4 | Length of the comment chunk. Zero if there's no comment. |
028 | 4 | Offset to the first byte of the creator-specific data chunk, or zero if there is none. |
02C | 4 | Length of the creator-specific chunk; zero if there is no creator-specific data. |
030 | 16 | Reserved space; this pads the header to 64 bytes. These values must all be zero. |
Image format field
The image format is indicated as one of the following values:Format | Value |
---|---|
DOS 3.3 Order | 0 |
ProDOS Order | 1 |
Nibblized data | 2 |
Flags
The flags field contains bit flags that specify details about the disk image. Bits not defined here must be zero.Bit | Description |
---|---|
31 | If this bit is set, the disk image is locked and no changes should be permitted to the disk data it contains. This is used by emulators to provide support for write-protecting disk images. |
8 | If this bit is set, the low byte of the flags field contains the DOS 3.3 volume number of the disk image. This bit should only be set for DOS 3.3 disk images. If the disk is DOS 3.3 format (the image format is 0), and this bit is 0, volume number 254 is assumed. |
7-0 | The DOS 3.3 volume number, from 0-254, if bit 8 is set. Otherwise these bits should be 0. |
Macintosh
In Mac OS X v10.2.3Mac OS X v10.2
Mac OS X version 10.2 "Jaguar" is the third major release of Mac OS X, Apple's desktop and server operating system. It superseded Mac OS X v10.1 code name Puma and preceded Mac OS X Panther...
, Apple introduced Internet-Enabled Disk Images for use with the Apple utility Disk Copy, which was integrated into Disk Utility
Disk Utility
Disk Utility is the name of a utility created by Apple for performing disk-related tasks in Mac OS X. These tasks include:*the creation, conversion, compression and encryption of disk images from a wide range of formats read by Disk Utility to .dmg or—for CD/DVD images—.cdr, which is identical to...
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 Disk Image in Mac OS 9
Mac OS 9
Mac OS 9 is the final major release of Apple's Mac OS before the launch of Mac OS X. Introduced on October 23, 1999, Apple positioned it as "The Best Internet Operating System Ever," highlighting Sherlock 2's Internet search capabilities, integration with Apple's free online services known as...
is to use either the developer version of Disk Copy
Disk Copy
Disk Copy was the default utility for handling disk images in System 7 through Mac OS X 10.2 . In later versions of Mac OS X it has been replaced by DiskImageMounter for mounting the images and Disk Utility for creating them.Although the last official public release of Disk Copy for Mac OS 9 was...
(version 6.4), 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.
Non-Macintosh
Apple has not released any documentation on the format, but attempts to reverse engineer parts of the format have been successful. Free softwareFree software
Free software, software libre or libre software is software that can be used, studied, and modified without restriction, and which can be copied and redistributed in modified or unmodified form either without restriction, or with restrictions that only ensure that further recipients can also do...
implementations include dmg2img and DMGExtractor.
The encrypted layer was reverse engineered in an implementation called VileFault (A spoonerism
Spoonerism
A spoonerism is an error in speech or deliberate play on words in which corresponding consonants, vowels, or morphemes are switched . It is named after the Reverend William Archibald Spooner , Warden of New College, Oxford, who was notoriously prone to this tendency...
of FileVault
FileVault
FileVault is a system which encrypts files on a Macintosh computer. It can be found in the Mac OS X v10.4 "Tiger" operating system and later....
), and dmg2img and DMGExtractor have since implemented support for encrypted images. DMG files can be converted into ISO files using software like PowerISO.
There are few options available to extract files or mount the proprietary Apple Disk Image format. The supported features are limited because of the proprietary nature of the format.
The well-known cross-platform and GPL
GNU General Public License
The GNU General Public License is the most widely used free software license, originally written by Richard Stallman for the GNU Project....
licensed format conversion utilities are:
- dmg2img
- DMGEXtractor
- PeaZipPeaZipPeaZip is a file manager and file archiver for Microsoft Windows and GNU/Linux. It supports its native PEA archive format and other mainstream formats, with special focus on handling open formats...
dmg2img was originally written in Perl
Perl
Perl is a high-level, general-purpose, interpreted, dynamic programming language. Perl was originally developed by Larry Wall in 1987 as a general-purpose Unix scripting language to make report processing easier. Since then, it has undergone many changes and revisions and become widely popular...
; however, the Perl version is no longer maintained, and the project was rewritten in C
C (programming language)
C is a general-purpose computer programming language developed between 1969 and 1973 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system....
. Currently, without additional tools, the resulting images may be mounted only under Mac OS X and under Linux
Linux
Linux is a Unix-like computer operating system assembled under the model of free and open source software development and distribution. The defining component of any Linux system is the Linux kernel, an operating system kernel first released October 5, 1991 by Linus Torvalds...
(provided hfsplus support has been enabled). UDIF ADC-compressed images have been supported since version 1.5.
DMGExtractor is written in Java
Java (programming language)
Java is a programming language originally developed by James Gosling at Sun Microsystems and released in 1995 as a core component of Sun Microsystems' Java platform. The language derives much of its syntax from C and C++ but has a simpler object model and fewer low-level facilities...
with GUI
Graphical user interface
In computing, a graphical user interface is a type of user interface that allows users to interact with electronic devices with images rather than text commands. GUIs can be used in computers, hand-held devices such as MP3 players, portable media players or gaming devices, household appliances and...
, and it supports more advanced features of dmg including AES-128 encrypted images but not UDCO images.
In Windows, most dmg images can be opened using several other programs such as Acute Systems TransMac, HFSExplorer, 7-Zip
7-Zip
7-Zip is an open source file archiver. 7-Zip operates with the 7z archive format, but can read and write several other archive formats. The program can be used from a command line interface, graphical user interface, or with Microsoft Windows shell integration. 7-Zip began in 1999 and is actively...
, UltraISO
UltraISO
UltraISO is an application for Microsoft Windows for creating, modifying and converting ISO image files used for optical disc authoring.Since the first release of UltraISO on 20 April 2002, its author EZB Systems has maintained and kept the product shareware.UltraISO is currently produced by EZB...
, and IsoBuster
IsoBuster
-External links:*...
. MacDrive can also mount simple dmg files as drives under windows, but not sparse disk or encrypted dmgs.
In Linux and possibly other Unix flavors, most .dmg files can be burned to CD/DVD using the program cdrecord or directly mounted to a mountpoint (e.g. mount -o loop,ro -t hfsplus imagefile.dmg /mnt/mountpoint).
PowerISO
PowerISO
PowerISO is an application used to create, open, mount / emulate, compress, encrypt, and otherwise manipulate CD / DVD image files. It is most commonly known for its proprietary DAA disc image format. Other supported formats include ISO, BIN, NRG, and CDI. PowerISO is able to modify all supported...
is a proprietary, cross platform, Freeware CLI tool that runs on Linux
Linux
Linux is a Unix-like computer operating system assembled under the model of free and open source software development and distribution. The defining component of any Linux system is the Linux kernel, an operating system kernel first released October 5, 1991 by Linus Torvalds...
; it can convert most proprietary image formats to ISO, and newer versions support .dmg.
See also
- cloopCloopThe compressed loopback device or cloop is a module for the Linux kernel. It adds support for transparently decompressed, read-only block devices. It is not a compressed file system in itself....
- DiskImageMounterDiskImageMounterDiskImageMounter is the utility that handles mounting disk images in Mac OS X, starting with version 10.3. Like BOMArchiveHelper it has no GUI when double-clicked; in fact, doing so does nothing. It is found in /System/Library/CoreServices/DiskImageMounter.app...
- Installer (Mac OS X)Installer (Mac OS X)Installer is an application included in Mac OS X which extracts and installs files out of .pkg packages. It was created by NeXT, and is now maintained by Apple Inc...
- RUNZ
- Sparse imageSparse imageA sparse image is a type of disk image file that can be created under Mac OS X using Disk Utility. Encrypted sparse image files are used to secure a user's home directory by the FileVault feature in Mac OS X Snow Leopard and earlier....
External links
- 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
- man page for hdiutil