What Is a DMG File? Everything You Need to Know About macOS Disk Images

If you've ever downloaded software on a Mac, you've almost certainly encountered a .dmg file. You double-click it, a virtual drive appears on your desktop, you drag an app somewhere, and then… what exactly just happened? Understanding what a DMG file actually is — and what it's doing behind the scenes — makes the whole process far less mysterious.

DMG Stands for Disk Image

A DMG file (short for Disk iMage) is a file format used primarily on macOS to package and distribute software. Think of it as a virtual hard drive stored inside a single file. When you open a DMG, macOS mounts it — meaning the operating system treats it like a physical disk that's been plugged in. That's why a drive icon appears on your desktop when you open one.

The format was introduced by Apple and replaced the older .img format. It's now the standard container for distributing macOS applications, though you'll occasionally encounter it used for other purposes like storing encrypted backups or bundled documents.

What's Actually Inside a DMG File

A DMG file is essentially a compressed archive that can contain:

  • A macOS application (.app file)
  • A license agreement screen shown before mounting
  • A custom background image with instructions (usually an arrow pointing from the app to the Applications folder)
  • Multiple files or folders packaged together
  • Occasionally, an installer package (.pkg) instead of a drag-and-drop app

When the disk image mounts, you see its contents just like browsing any drive. The typical install flow — dragging the app to your Applications folder — is actually just copying files from the virtual disk to your real storage.

How DMG Files Work Technically 🖥️

Under the hood, a DMG file uses one of several internal formats:

Format TypeWhat It Means
UDIF (Universal Disk Image Format)The standard modern format for macOS disk images
CompressedContents are compressed (often with zlib), reducing download size
EncryptedContents are protected with AES-128 or AES-256 encryption
Read/WriteThe image can be modified after creation
Read-OnlyContents cannot be changed — most distributed software uses this

Most DMG files you download from the internet are read-only and compressed. This keeps the file size manageable while preventing tampering. When mounted, macOS decompresses the contents in memory so you can interact with them normally.

Apple's Disk Utility app (built into macOS) can create, convert, verify, and mount DMG files. Developers use it — and command-line tools like hdiutil — to build disk images for software distribution.

Why Developers Use DMG Files for Distribution

The DMG format solves a few practical problems at once:

  • Single-file packaging — everything needed ships in one container
  • Custom presentation — developers can style the install window with a background, icon positions, and instructions
  • License agreement enforcement — macOS can prompt users to accept terms before the image mounts
  • Compression — files shrink significantly for faster downloads
  • Integrity verification — DMG files support checksums so users (and macOS) can verify nothing was corrupted or altered

This is why established software projects often use DMG for distribution even though macOS also supports the .pkg installer format and the Mac App Store. DMG gives developers more control over the experience without requiring a full installer routine.

DMG vs. ZIP vs. PKG: What's the Difference?

You'll often see macOS software distributed in three formats. They're not interchangeable:

FormatHow It WorksBest For
.dmgMounts as a virtual disk; usually drag-to-installMost standalone macOS apps
.zipStandard compressed archive; extracts directlySimple single-file tools, smaller utilities
.pkgRuns an installer with steps and system-level accessComplex software needing deep system integration

A ZIP is simpler but offers no custom UI or license prompts. A PKG runs a proper installer and can write files to protected system locations — useful for drivers, system extensions, or apps with many components. A DMG sits in the middle: more polished than a ZIP, less invasive than a PKG.

Are DMG Files Safe? 🔒

DMG files themselves are just containers — they're not inherently dangerous. But like any file you download from the internet, the contents matter.

A few things worth knowing:

  • Gatekeeper — macOS's built-in security feature checks DMG files for a valid Apple developer signature before allowing them to mount. If a file is unsigned or from an unidentified developer, macOS will warn you.
  • Notarization — since macOS Catalina, Apple requires software to be notarized (scanned and approved by Apple's automated systems) for smooth installation. Non-notarized apps trigger warnings.
  • Encrypted DMGs — can be used legitimately for secure backups, or occasionally misused to hide content from security scans. Context matters.
  • Source matters — downloading a DMG directly from a developer's official site carries far less risk than from a third-party hosting page.

If macOS flags a DMG file and you weren't expecting that warning, that's worth paying attention to.

When You Might Create a DMG Yourself

DMG files aren't just for receiving software — you can create them:

  • Packaging an app you've built for distribution
  • Creating an encrypted disk image as a secure vault for sensitive files
  • Archiving a set of files in a single portable container
  • Making a bootable disk image for system recovery

macOS's Disk Utility handles all of these through a straightforward interface. For automation or scripting, the hdiutil command-line tool gives granular control over every parameter.

The Variables That Shape Your Experience

How you interact with DMG files depends on several factors that vary by user:

  • macOS version — older systems may not recognize newer DMG subtypes or notarization requirements
  • Security settings — your Gatekeeper configuration (in System Settings > Privacy & Security) affects which DMGs open without friction
  • Storage type and speed — mounting a large, compressed DMG is faster on an SSD than on older spinning storage
  • Technical comfort level — drag-to-install works intuitively for most users, but command-line creation and conversion requires familiarity with Terminal
  • Use case — casual app installation looks very different from using encrypted DMGs for secure file storage or developer workflows for software packaging

The format is the same across all these scenarios. What differs is how deeply you need to understand or interact with it — and that depends entirely on what you're trying to do.