What Is a DMG File?
A DMG file is Apple's proprietary disk image format, introduced in Mac OS X as the replacement for older formats like SIT (StuffIt) and the original Apple Disk Image (.img). When you open a DMG on macOS, it mounts as a virtual disk — the Finder sees it as a real volume, letting you drag-and-drop to install applications or access files exactly as if you had inserted a physical disc.
A DMG can contain:
- HFS+ or APFS formatted volume — the standard macOS filesystems
- Compressed data — using zlib (most common) or bzip2 for smaller file sizes
- Encrypted content — AES-128 or AES-256 encryption with password protection
- Read-only or read-write volumes — read-only for app distribution, read-write for editable disk images
- Hybrid (ISO/HFS) layouts — for cross-platform discs compatible with both Mac and PC
- Sparse images — DMG files that grow dynamically as data is added
Where DMG Files Are Used
DMG is ubiquitous in the macOS ecosystem:
- macOS application distribution — virtually every Mac application outside the App Store is distributed as a DMG. The familiar workflow: open DMG → drag app to Applications folder → eject DMG → run the app.
- OS X/macOS installer images — older macOS versions (Snow Leopard through El Capitan) were distributed as DMG files from the App Store or physical media.
- Developer beta distribution — Apple and third-party developers distribute pre-release software as DMG files to avoid App Store review cycles.
- Time Machine sparsebundles — Time Machine backups stored on network drives use
.sparsebundle(a directory-based DMG variant) rather than a monolithic DMG. - Encrypted secure storage — users and sysadmins create encrypted read-write DMG files as portable secure containers for sensitive documents.
DMG Subtypes and Formats
The hdiutil tool (macOS) identifies DMG files by their internal format code:
| Format Code | Name | Description |
|---|---|---|
| UDRO | Read-only | No compression |
| UDZO | Compressed (read-only) | zlib compression — most common for app distribution |
| UDBZ | Bzip2 compressed | Better compression ratio than zlib, slower |
| UDCO | ADC compressed | Apple Data Compression (legacy, rare) |
| UDRW | Read-write | Uncompressed, mountable and modifiable |
| UDSP | Sparse | Grows dynamically; space allocated on demand |
| UDSB | Sparse bundle | Directory-based sparse image (Time Machine) |
When downloading Mac apps, you'll almost always encounter UDZO (zlib compressed, read-only). This is the format that mounts instantly and is the smallest practical distribution format.
Opening DMG Files on macOS
The native workflow is straightforward:
- Double-click the
.dmgfile — macOS verifies it and mounts the volume - A Finder window opens showing the volume contents (typically an app icon and an Applications folder alias)
- Drag the app icon into the Applications folder alias (or to
/Applications/in Finder) - Eject the DMG volume (drag to Trash or right-click → Eject)
- The
.dmgfile itself can be deleted — the app is now installed
macOS Gatekeeper checks the code signature of the DMG and its contents during this process.
Opening DMG Files on Windows
Windows cannot natively mount or read HFS+/APFS volumes. Your options depend on how complex the DMG is:
7-Zip (free): Right-click the DMG file → 7-Zip → Extract Here. Works well for many DMG files but may fail on HFS+-formatted volumes — 7-Zip understands the DMG container but not always the HFS+ filesystem inside.
HFSExplorer (free, requires Java): A dedicated HFS+/APFS browser for Windows. Open the DMG file directly, browse the filesystem, and extract files. Reliable for most standard HFS+ DMGs.
DMG Extractor (free limited / paid full): The most reliable Windows tool specifically for DMG files. The free version has limitations on DMG size; the paid version handles all types including encrypted and APFS.
TransMac (trial, paid): Mounts HFS+ volumes on Windows as if they were real drives. Useful when you need full filesystem access rather than just file extraction.
Virtual Machine: If you need to actually run the macOS application inside the DMG, you need a macOS virtual machine (VMware, Parallels, or UTM on Apple Silicon). Windows cannot execute macOS applications.
Opening DMG Files on Linux
Linux has better HFS+ support than Windows, though APFS support is still limited:
Using dmg2img + mount:
# Install dmg2img
sudo apt install dmg2img # Debian/Ubuntu
sudo dnf install dmg2img # Fedora
# Convert DMG to a mountable image
dmg2img input.dmg output.img
# Mount the resulting image (HFS+)
sudo mkdir -p /mnt/dmg
sudo mount -t hfsplus -o loop output.img /mnt/dmg
Using hfsutils directly:
sudo apt install hfsutils hfsprogs
sudo mount -t hfsplus -o loop image.dmg /mnt/dmg
# Note: direct DMG mounting works only for UDRW/uncompressed DMGs
Using 7-Zip:
7z x image.dmg
Works for simple non-HFS-partitioned DMGs but may extract raw partition data rather than files for HFS+-formatted volumes.
Converting DMG to ISO and Other Formats
DMG to ISO (on macOS — most reliable method):
hdiutil convert input.dmg -format UDTO -o output.cdr
mv output.cdr output.iso
The UDTO format produces a .cdr file (CD/DVD master) which is byte-compatible with ISO 9660 and can be renamed to .iso for use on any platform.
DMG to ISO (on Linux using dmg2img):
dmg2img input.dmg output.img
# Rename to .iso if needed — for HFS+ images, mount as hfsplus not iso9660
mv output.img output.iso
DMG to ZIP (extract files only):
- Extract with HFSExplorer or 7-Zip
- ZIP the resulting folder with your preferred tool
DMG to UDZO (recompress):
hdiutil convert input.dmg -format UDZO -o output.dmg
Useful to recompress a read-write UDRW DMG to a smaller read-only UDZO for distribution.
Creating DMG Files (macOS)
From a folder (command line):
hdiutil create -volname "MyApplication" -srcfolder /path/to/app -ov -format UDZO output.dmg
From a folder (Disk Utility GUI): Disk Utility → File → New Image → Image from Folder → select folder → choose compression → Save
Create a blank read-write DMG (encrypted):
hdiutil create -size 500m -volname "SecureVault" -fs HFS+ -encryption AES-256 secure.dmg
# You'll be prompted for a password
DMG vs ISO Comparison
| Feature | DMG | ISO |
|---|---|---|
| Native platform | macOS | Universal |
| Compression | Yes (zlib/bzip2) | No |
| Encryption | Yes (AES-128/256) | No |
| Windows support | Limited (3rd-party tools) | Native (Win 10/11) |
| Linux support | Partial (dmg2img + hfsplus) | Native |
| Use case | Mac app distribution | OS installation, archiving |
| Filesystem | HFS+ / APFS | ISO 9660 / UDF |
Security Considerations
macOS Gatekeeper automatically checks DMG files and their contents for:
- Code signature — verifies the developer identity
- Notarization — Apple's malware scan (required since macOS Catalina for smooth opening)
- Quarantine flag — files downloaded from the internet are flagged; Gatekeeper checks them on first open
Warning signs of malicious DMGs:
- The DMG asks you to right-click → Open to bypass Gatekeeper
- The installer asks for your password unnecessarily
- The app inside has a name similar to a legitimate app but the DMG URL is not the official developer site
- The DMG contains a
.pkginstaller when you expected a simple drag-to-install app
Always download DMG files from the official developer website or the Mac App Store. Never open DMG files received in emails or from file-sharing sites for software that should be commercial or free from a reputable source.
Related conversions
Most teams that read this guide convert images in one of these directions: