Let’s go through the steps of creating a dmg file using Disk Utility. Third party software may come with a slicker interface, but it really isn’t necessary. You could download the software for creating disk images but you can also create a dmg file using OS X’s built-in “Disk Utility” program. So we know that dmg files are disk image files that are useful for delivering software (or any type of files) to other Macs. Just click the “eject” button next to the disk name in Finder. When you’re finished using a dmg file you need to eject it like you would any external hard drive.
But dmg files can also contain a directory of files. Other times they might contain and package installation file (pkg file), which you need to run to install the software. Often they just contain the app file which you drag to the Applications folder to install. The common use of dmg files is to install software. Clicking on the mounted dmg file will reveal the contents.