Apple
Disk Image is a
disk image
A disk image, in computing, is a computer file containing the contents and structure of a disk volume or of an entire data storage device, such as a hard disk drive, tape drive, floppy disk, optical disc, or USB flash drive. A disk image is usu ...
format commonly used by the
macOS
macOS (; previously OS X and originally Mac OS X) is a Unix operating system developed and marketed by Apple Inc. since 2001. It is the primary operating system for Apple's Mac (computer), Mac computers. Within the market of ...
operating system. When opened, an Apple Disk Image is
mount
Mount is often used as part of the name of specific mountains, e.g. Mount Everest.
Mount or Mounts may also refer to:
Places
* Mount, Cornwall, a village in Warleggan parish, England
* Mount, Perranzabuloe, a hamlet in Perranzabuloe parish, ...
ed as a volume within the
Finder
Finder may refer to:
* Finder (surname)
* Finder (software), part of the Apple Macintosh operating system
* ''Finder'' (comics), a comic book series by Carla Speed McNeil
* ''Finder'' (novel), a 1994 novel by Emma Bull
* Finder Wyvernspur, a fi ...
.
An Apple Disk Image can be structured according to one of several proprietary disk image formats, including the Universal Disk Image Format (UDIF) from
Mac OS X
macOS (; previously OS X and originally Mac OS X) is a Unix operating system developed and marketed by Apple Inc. since 2001. It is the primary operating system for Apple's Mac computers. Within the market of desktop and lapt ...
and the New Disk Image Format (NDIF) from
Mac OS 9
Mac OS 9 is the ninth major release of Apple's classic Mac OS operating system which was succeeded by Mac OS X (renamed to OS X in 2011 and macOS in 2016) in 2001. Introduced on October 23, 1999, it was promoted by Apple as "The Best Internet ...
. An Apple disk image file's name usually has ".dmg" as its extension. A disk image is a compressed copy of the contents of a disk or folder. Disk images have .dmg at the end of their names. To see the contents of a disk image, you must first open the disk image so it appears on the desktop or in a Finder window.
Features
Apple Disk Image files are published with a
MIME type
A media type (also known as a MIME type) is a two-part identifier for file formats and format contents transmitted on the Internet. The Internet Assigned Numbers Authority (IANA) is the official authority for the standardization and publication o ...
of ''application/x-apple-diskimage''.
Different
file systems
In computing, file system or filesystem (often abbreviated to fs) is a method and data structure that the operating system uses to control how data is stored and retrieved. Without a file system, data placed in a storage medium would be one larg ...
can be contained inside these disk images, and there is also support for creating hybrid
optical media
In computing and optical disc recording technologies, an optical disc (OD) is a flat, usually circular disc that encodes binary data (bits) in the form of pits and lands on a special material, often aluminum, on one of its flat surfaces. ...
images that contain multiple file systems.
Some of the file systems supported include
Hierarchical File System
Hierarchical File System (HFS) is a proprietary file system developed by Apple Inc. for use in computer systems running Mac OS. Originally designed for use on floppy and hard disks, it can also be found on read-only media such as CD-ROMs. HF ...
(HFS),
HFS Plus
HFS Plus or HFS+ (also known as Mac OS Extended or HFS Extended) is a journaling file system developed by Apple Inc. It replaced the Hierarchical File System (HFS) as the primary file system of Apple computers with the 1998 release of Mac OS ...
(HFS+),
File Allocation Table
File Allocation Table (FAT) is a file system developed for personal computers. Originally developed in 1977 for use on floppy disks, it was adapted for use on hard disks and other devices. It is often supported for compatibility reasons by ...
(FAT),
ISO9660
ISO 9660 (also known as ECMA-119) is a file system for optical disc media. Being sold by the International Organization for Standardization (ISO) the file system is considered an international technical standard. Since the specification is ava ...
, and
Universal Disk Format
Universal Disk Format (UDF) is an open, vendor-neutral file system for computer data storage for a broad range of media. In practice, it has been most widely used for DVDs and newer optical disc formats, supplanting ISO 9660. Due to its design, ...
(UDF).
Apple Disk Images can be created using utilities bundled with Mac OS X, specifically
Disk Copy
Disk Copy was the default utility for handling logical volume images in System 7 through Mac OS X 10.2 (usable in System Software 6 as well). In later versions of macOS it has been replaced by DiskImageMounter for mounting the images and Disk ...
in
Mac OS X v10.2 and earlier and
Disk Utility
A disk utility is a utility program that allows a user to perform various functions on a computer disk, such as disk partitioning and logical volume management, as well as multiple smaller tasks such as changing drive letters and other mount p ...
in
Mac OS X v10.3
Mac OS X Panther (version 10.3) is the fourth major release of macOS, Apple's desktop and server operating system. It followed Mac OS X Jaguar and preceded Mac OS X Tiger. It was released on October 24, 2003.
System requirements
Panther's s ...
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 interface
A command-line interpreter or command-line processor uses a command-line interface (CLI) to receive commands from a user in the form of lines of text. This provides a means of setting parameters for the environment, invoking executables and pro ...
using the utility.
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
A disk utility is a utility program that allows a user to perform various functions on a computer disk, such as disk partitioning and logical volume management, as well as multiple smaller tasks such as changing drive letters and other mount p ...
in 10.3. The Disk Copy application had the ability to display a multilingual software license agreement before mounting a disk image. The image will not be mounted unless the user indicates agreement with the license.
An Apple Disk Image allows secure password protection as well as
file compression
In information theory, data compression, source coding, or bit-rate reduction is the process of encoding information using fewer bits than the original representation. Any particular compression is either lossy or lossless. Lossless compression ...
, and hence serves both security and file distribution functions; such a disk image is most commonly used to distribute software over the Internet.
History
Apple originally created its disk image formats because the
resource fork The resource fork is a fork or section of a file on Apple's classic Mac OS operating system, which was also carried over to the modern macOS for compatibility, used to store structured data along with the unstructured data stored within the data fo ...
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.
A previous version of the format, intended only for
floppy disk
A floppy disk or floppy diskette (casually referred to as a floppy, or a diskette) is an obsolescent type of disk storage composed of a thin and flexible disk of a magnetic storage medium in a square or nearly square plastic enclosure lined ...
images, is usually referred to as "Disk Copy 4.2" format, after the version of the
Disk Copy
Disk Copy was the default utility for handling logical volume images in System 7 through Mac OS X 10.2 (usable in System Software 6 as well). In later versions of macOS it has been replaced by DiskImageMounter for mounting the images and Disk ...
utility that was used to handle these images.
A similar format that supported compression of floppy disk images is called DART.
New Disk Image Format (NDIF) was the previous default disk image format in
Mac OS 9
Mac OS 9 is the ninth major release of Apple's classic Mac OS operating system which was succeeded by Mac OS X (renamed to OS X in 2011 and macOS in 2016) in 2001. Introduced on October 23, 1999, it was promoted by Apple as "The Best Internet ...
,
and disk images with this format generally have a ''.img'' (not to be confused with
raw ''.img'' disk image files) or ''.smi'' file extension. Files with the ''.smi'' extension are actually applications that mount an embedded disk image, thus a "Self Mounting Image", intended only for Mac OS 9 and earlier.
Universal Disk Image Format (UDIF) is the
native format
A native format, in the context of software applications, refers to the file format which the application is designed to work with. It captures the internal reality of the program as well as is possible. Most likely this is also the default format ...
disk image format for
Mac OS X
macOS (; previously OS X and originally Mac OS X) is a Unix operating system developed and marketed by Apple Inc. since 2001. It is the primary operating system for Apple's Mac computers. Within the market of desktop and lapt ...
. Disk images in this format typically have a ''.dmg'' extension.
File format
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 (a
spoonerism
A spoonerism is an occurrence in speech in which corresponding consonants, vowels, or morphemes are switched (see metathesis) between two words in a phrase. These are named after the Oxford don and ordained minister William Archibald Spooner, ...
of
FileVault
FileVault is a disk encryption program in Mac OS X 10.3 (2003) and later. It performs on-the-fly encryption with volumes on Mac computers.
Versions and key features
FileVault was introduced with Mac OS X Panther (10.3), and could only be a ...
).
Apple disk image files are essentially raw
disk image
A disk image, in computing, is a computer file containing the contents and structure of a disk volume or of an entire data storage device, such as a hard disk drive, tape drive, floppy disk, optical disc, or USB flash drive. A disk image is usu ...
s (i.e. contain block data) with some added metadata, optionally with one or two layers applied that provide compression and encryption. In , these layers are called CUDIFEncoding and CEncryptedEncoding.
UDIF supports ADC (an old proprietary compression format by Apple),
zlib
zlib ( or "zeta-lib", ) 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 ...
,
bzip2 (as of
Mac OS X v10.4
Mac OS X Tiger (version 10.4) is the 5th major release of macOS, Apple's desktop and server operating system for Mac computers. Tiger was released to the public on April 29, 2005 for US$129.95 as the successor to Mac OS X 10.3 Panther. Some o ...
),
LZFSE
LZFSE (Lempel–Ziv Finite State Entropy) is an open source lossless data compression algorithm created by Apple Inc. It was released with a simpler algorithm called LZVN.
Overview
The name is an acronym for Lempel–Ziv and finite-state e ...
(as of
Mac OS X v10.11), and
lzma (as of
macOS v10.15) compression internally.
Metadata
The UDIF metadata is found at the end of the disk image following the data. This trailer can be described using the following C structure.
All values are
big-endian
In computing, endianness, also known as byte sex, is the order or sequence of bytes of a word of digital data in computer memory. Endianness is primarily expressed as big-endian (BE) or little-endian (LE). A big-endian system stores the most si ...
(PowerPC byte ordering)
typedef struct __attribute__((packed, scalar_storage_order("big-endian"))) UDIFResourceFile;
The XML plist contains a (blocks) key, with information about how the preceding data fork is allocated. The main data is stored in a base64 block, using tables identified by the magic . This structure contains a table about blocks of data and the position and lengths of each "chunk" (usually only one chunk, but compression will create more).
[ The data and resource fork information is probably inherited from NDIF.
]
Encryption
The encryption layer comes in two versions. Version 1 has a trailer at the end of the file, while version 2 (default since OS X 10.5) puts it at the beginning. Whether the encryption is a layer outside of or inside of the metadata (UDIF) is unclear from reverse engineered documentation, but judging from the demonstration it's probably outside.
Utilities
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
Perl is a family of two High-level programming language, high-level, General-purpose programming language, general-purpose, Interpreter (computing), interpreted, dynamic programming languages. "Perl" refers to Perl 5, but from 2000 to 2019 it ...
; however, the Perl version is no longer maintained, and the project was rewritten in C. It extracts the raw disk image from a DMG, without handling the file system inside. UDIF ADC-compressed images (UDCO) have been supported since version 1.5.
* ''DMGEXtractor'' is written in Java
Java (; id, Jawa, ; jv, ꦗꦮ; su, ) is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea to the north. With a population of 151.6 million people, Java is the world's mo ...
with a graphical user interface
The GUI ( "UI" by itself is still usually pronounced . or ), graphical user interface, is a form of user interface that allows User (computing), users to Human–computer interaction, interact with electronic devices through graphical icon (comp ...
(GUI), and it supports more advanced features of dmg including AES-128 encrypted images but not UDCO images.
* ''The Sleuth Kit
The Sleuth Kit (TSK) is a library and collection of Unix- and Windows-based utilities for extracting data from disk drives and other storage so as to facilitate the forensic analysis of computer systems. It forms the foundation for Autopsy, a b ...
''. Only handles uncompressed DMG format, HFS+, and APFS.
Most dmg files are unencrypted. Because the dmg metadata is found in the end, a program not understanding dmg files can nevertheless read it as if it was a normal disk image, as long as there is support for the file system inside. Tools with this sort of capacity include:
* Cross-platform: 7-zip
7-Zip is a free and open-source file archiver, a utility used to place groups of files within compressed containers known as "archives". It is developed by Igor Pavlov and was first released in 1999. 7-Zip has its own archive format called 7 ...
(HFS/HFS+), PeaZip
PeaZip is a free and open-source file manager and file archiver for Microsoft Windows, ReactOS, Linux, MacOS and BSD made by Giorgio Tani. It supports its native PEA archive format (featuring compression, multi volume split and flexible auth ...
(HFS/HFS+).
* Windows: UltraISO
UltraISO is a crippleware application for Microsoft Windows for creating, modifying and converting ISO image files used for optical disc authoring, currently being produced by EZB Systems.
Initially UltraISO was shareware however since 2006 i ...
, IsoBuster
IsoBuster is a data recovery computer program by Smart Projects, a Belgian company founded in 1995 by Peter Van Hove. As of version 3.0, it can recover data from damaged file systems or physically damaged disks including optical discs, hard di ...
, MacDrive (HFS/HFS+).
* Unix-like: cdrecord
cdrtools (formerly known as cdrecord) is a collection of independent projects of free software/open source computer programs.
The project was maintained for over two decades by Jörg Schilling, who died on October 10, 2021.
Because of some ...
and (e.g. ).
Tools with specific dmg support include:
* Windows:
** Transmac can handle both UDIF .dmg files and sparsebundles, as well as HFS/HFS+ and APFS. It is unknown whether it handles encryption. It can be used to create bootable macOS installers under Windows.
** A free Apple DMG Disk Image Viewer also exists, but it is unknown how much what it actually supports.
* Unix-like:
** darling-dmg is a FUSE module enabling easy DMG file mounting on Linux. It supports UDIF and HFS/HFS+.
See also
* cloop
The compressed loop device (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: cloop is mostly used as a convenient way to compress conventional fi ...
* DiskImageMounter
* Installer (macOS)
This is a list of macOS built-in apps and system components.
Applications
App Store
The Mac App Store is macOS's digital distribution platform for macOS apps, created and maintained by Apple Inc. based on the iOS version, the platform was a ...
* Sparse image
A sparse image is a type of disk image file used on macOS that grows in size as the user adds data to the image, taking up only as much disk space as stored in it. Encrypted sparse image files are used to secure a user's home directory by the Fi ...
References
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
{{Disk images
Apple Inc. file systems
Archive formats
Compression file systems
Disk images
MacOS
Year of introduction missing