Why Does macOS Use DMG Files for New Applications?

When you download a new program for your Mac, it often comes with a “.dmg” file. Easily identifiable by their disk-on-paper icon, the “dmg” extension stands for disk image. When you double-click on the dmg, it mounts (or, more properly, attaches), revealing its contents in the Finder. From there, users drag and drop the image’s contents into the Applications directory to install new apps on their Macs.

This process is very different from Windows’ installer-lead process and can lead to misadventures for new macOS users. When I was migrating from Windows, I had no clue this last step was required. After all, many programs can run perfectly from their disk image, and disk images don’t always explain the “drag-to-Applications” step. As a result, I launched Firefox from the disk image for about a month until I realized I didn’t have any bookmarks and couldn’t understand why.

So why are DMG files necessary for new applications, and what’s the point of “mounting” something just to drag and drop a file?

why-does-macos-use-dmgs-application-structure

While a Mac application is represented by an attractive icon that you double-click to launch the application, that icon conceals a secret. That .app file actually represents a package.┬áThat’s essentially a folder containing all the application’s files.

See for yourself: right-click on any application in Finder and select “Show Package Contents” to explore on your own. Because macOS applications are essentially folders, they need some kind of container to transport them to new computers without losing files. Transferring a naked folder can be messy, especially across networks.

It’s like transporting a dozen eggs without a carton. And it turns out that the DMG makes a pretty good egg carton. Of course, other formats can hold a folder; what else makes the DMG so enduring?

why-does-macos-use-dmgs-aesthetic-customization

Disk images also offer a unique benefit: the ability to customize their appearance and the user’s installation experience. This includes setting features like custom icons, icon positioning, and background images.

When you open a disk image and see an arrow prompting you to drag the app into the Applications folder, you’re actually looking at the background image of the DMG. This isn’t possible with other container formats, and macOS developers are sensitive to visual design. ZIP archives can offer compression, but they can’t offer this degree of “installation experience” without running an actual installer. Instead, the unzipping program just drops files into a folder, offering the developer little aesthetic control.

Remember that disk images became popular (and were adopted by Apple) in the day of physical media. In that ancient time, users would buy software by traveling to a store and purchasing a box containing an application’s installation CD. They would then insert the CD into their CD drive and drag the application from the “mounted” CD to the Applications folder. They would follow this by ejecting the CD and putting it back in its jewel case for future installations.

The disk image mimics that process, piggy-backing on a familiar user behavior. Images can also be read-only (just like a CD), preventing the user from damaging or altering the known good copy of the application. Users can archive disk images, knowing they’ll have a functional copy of the app shelved away in case of emergency.

why-does-macos-use-dmgs-alternatives

Disk images still see a lot of use, even today. Along with their benefits, DMGs have developed a crust of tradition and expectation. Users expect new software to be delivered via DMG, so developers provide it that way. But you’ll also find a reasonable quantity of bare .app files inside ZIP archives scattered across the Internet.┬áThis is especially true for applications from GitHub or smaller developers.

You might also see applications come in packages (.pkg) with installers onboard. Developers use the package format when the application needs to execute instructions upon opening. It’s especially useful when the program needs to copy files to directories outside of “/Applications.” For example, if the installer needs to install custom fonts or copy files to the Library directory, a package format can accomplish that with an installer.

If you’re interested in all this, you can read about the history of the disk image.

Leave a Reply

Yeah! You've decided to leave a comment. That's fantastic! Check out our comment policy here. Let's have a personal and meaningful conversation.