I've noticed that many downloads are a dmg (disk image) that contains a single pkg file (installation package). Usually the pkg seems to be already compressed since the dmg doesn't reduce the file size much if any.


A savings of 737,658 bytes, or 0.6% of the original file size.

Is there a reason not to just distribute the pkg? Is the 0.6% compression savings that important? Or is it just the way things have always been done on the Mac?

(Yes, I realize that 737,658 bytes times all the millions of downloads that dmg gets does add up, but it just always seems annoying to have that extra steps in there to mount a dmg, run the installer and then unmount the dmg. Maybe a better question is "why doesn't Mac OS X recognize a dmg with a single pkg inside it as just a pkg and simply install it without requiring all that mounting and unmounting?")

  • Actually modern packages are flat files, not folders. So putting them in a dmg just to provide a flat file is no longer necessary.
    – mlaster
    Nov 9, 2011 at 17:48
  • @mlaster That doesn't appear to be true. Do you have an example?
    – Gerry
    Nov 11, 2011 at 17:24
  • 1
    radiosilenceapp.com/downloads/Private%20Eye.pkg is one example, as is JavaForMacOSX10.7.pkg (although Apple still has it as a .dmg when it is ready for download). I have several others in my Downloads archive, but it's definitely not universal yet. file lists them as "xar archive - version 1" But then there's the issue of making sure that the web server is setup to force .pkg files to download rather than display. (I expect some devs use .zip instead of .dmg for the same reason - even the worst configured web servers and browsers know to download .zip files).
    – TJ Luoma
    Nov 16, 2011 at 16:56
  • 1
    However, even once we got flat files, lots of developers put .pkg files inside a .zip because they can count on servers to have their MIME type set correctly for .zip files but not necessarily for .pkg (or .dmg for that matter).
    – TJ Luoma
    Dec 11, 2013 at 18:33

4 Answers 4


Technically, a .pkg is not a file, but a folder. So maybe collecting it into a single file is essential for downloading.

  • 1
    I didn't even realize this, but you hit the nail on the head.
    – Gerry
    Nov 9, 2011 at 16:33
  • Didn't know that about a .pkg either. Knowing that it all makes sense. Thanks! Nov 14, 2011 at 17:41
  • 2
    Packing it into a dmg means any OS X extended file attributes and/or resource forks are preserved and you can serve it from a non-OS X webserver. It is also why the package format was updated to include flat files in recent versions of OS X.
    – Joe Block
    Feb 17, 2014 at 0:02
  • 7
    This answer is not exactly true anymore, .pkg files are nowadays more than a plain folder: en.wikipedia.org/wiki/Installer_(OS_X)#Installer_package
    – t0r0X
    Apr 8, 2015 at 14:31
  • 1
    @wisbucky: that must be more recent than 2011, as noted by t0r0X.
    – GEdgar
    Jun 16, 2015 at 21:21

Data on DMG image can be checked for integrity with Disk utility. You can make it mandatory for the user to agree to license before mounting dmg. It could be locked from modification. You can easily add hidden files and folders on DMG. You can make background image. You can make it safe from stripping during transit through non-metadata aware file systems like FAT.

Plenty of reasons actually.

  • 2
    All cool features of a DMG, but they don't add anything to a PKG unless they seriously cannot verify their own integrity. Nov 9, 2011 at 13:23

One possible reason could be that Safari by default automatically mounts DMG files, and that a Finder window would pop up with the contents. In turn the DMG folder could be styled with for example a background image. I assume that could be considered more user-friendly than having to look in your Downloads folder for an installer, but I agree it's pretty moot.

Another reason would be the ability to group together other supporting files as well, for example documentation files or even secondary installers.

However, it's not such a common distribution to start with. The majority of apps are distributed as self-contained .app folders inside a DMG file (if not via the App Store now). Your example seems to be rather an exception to me, though maybe it is more common with some particular distribution channels? Personally, I wouldn't dwell on it much further.

  • 1
    + 1 for the last paragraph - I thought due to som trojans .dmg s are not (definitely should not) be automatically mounted
    – mmmmmm
    Nov 9, 2011 at 15:53
  • @Gerry, Automatically mounted?? What crazy setting is this?
    – Pacerier
    Feb 14, 2018 at 10:42
  • @Gerry, Doesn't this contradict "..agree to license.." in apple.stackexchange.com/a/30698/6533 ?
    – Pacerier
    Feb 14, 2018 at 10:42

Yet another reason is that you can't run .pkg files directly from Network volumes, but you can run a .dmg from a network volume and then launch the package.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .