Skip to content

Instantly share code, notes, and snippets.

@jadeatucker
Last active December 20, 2025 20:51
Show Gist options
  • Select an option

  • Save jadeatucker/5382343 to your computer and use it in GitHub Desktop.

Select an option

Save jadeatucker/5382343 to your computer and use it in GitHub Desktop.
How to create a "DMG Installer" for Mac OS X

Creating a "DMG installer" for OS X

A DMG Installer is convenient way to provide end-users a simple way to install an application bundle. They are basically a folder with a shortcut to the Applications directory but they can be customized with icons, backgrounds, and layout properties. A DMG file (.dmg) is a Mac OS X Disk Image file and it is used to package files or folders providing compression, encryption, and read-only to the package.

##Creating the DMG file #Disk Utility Type Disk Utility into Spotlite CMD+SPACEBAR from Finder or from Terminal:

open /Applications/Utilities/Disk\ Utility.app/

File -> New -> Disk Image from Folder or CMD+SHIFT+N

Select the folder myapp.app/ when prompted then click Image.

In the Save As field enter a name for the file like myapp.dmg.

From the Image Format drop-down select read/write then click Save.

#Edit Folder Preferences Mount the dmg and open it by double-clicking the file in Finder or from Terminal:

open myapp.dmg
open /Volumes/myapp/

Create a link/shortcut to /Applications folder by right-clicking on the Applications folder and selecting Make Alias then drag it into the dmg folder or from Terminal:

cd /Volumes/myapp/
ln -s /Applications Applications

In Finder press CMD+1 to switch to icon view and arrange icons as needed.

Press CMD+J to show the View Options window and adjust view settings as needed.

From Background: section choose Picture then Drag and drop the image you want to use as the background where it says Drag image here.

Unmount/Eject the dmg when finished with View Options or from Terminal:

umount /Volumes/myapp/

#Compress and convert to Read-only From Disk Utility right-click on myapp.dmg disk image and select Convert "myapp.dmg".

In the Save As field enter a new name for the file like myappfinal.dmg.

From the Image Formate drop-down select read-only then click Save or from Terminal:

hdiutil convert -format UDZO -o myappfinal.dmg myapp.dmg

#FIN Congratulations you are finished! Mount the new dmg to verify it is working properly.

@insha
Copy link

insha commented Sep 14, 2022

The DropDMG app is one of the best ways (I have personally used it for a long time) for creating dmg files for this purpose and in general.

@TheKevinWang
Copy link

seems like there is no option to convert dmg in Dick Utility anymore.
why pay for an app or use closed source trial just to create dmg files?
the stupidity of mac lol

@insha
Copy link

insha commented Oct 1, 2024

seems like there is no option to convert dmg in Dick Utility anymore. why pay for an app or use closed source trial just to create dmg files? the stupidity of mac lol

Not exactly sure of the ask about "option to convert dmg", but if you can mount the "image" and then use Disk Utility to create a DMG from it should work. The option to create a DMG is still there, at least on macOS Sequoia (15.x). File > New Image > ... this will create a new DMG either a blank on or from folder or a mounted volume, if I believe it has a compatible file system format.

Screenshot 2024-10-01 at 8 19 00 AM

@Barreloofy
Copy link

Barreloofy commented Dec 20, 2025

For anyone who, like me, completely failed to make any of these guides work. Here is a concise step-by-step guide for macOS 26:

  1. Create a new folder. Place your app inside it, along with an alias to the Applications folder.

  2. Open Disk Utility. Go to File > New Image > Image from Folder (or use the shortcut Cmd + Shift + N).

  3. Select the folder from Step 1 as the source. Under "Image Format," choose "Sparse Bundle Image". Save the image.

  4. Mount the image by double-clicking it. It will appear under "Locations" in Finder, navigate to it there.

  5. Inside the mounted image, press Cmd + J to open the view options. Customize the icon order, size, background, etc.

  6. Once customized, eject the image.

  7. Open Disk Utility again. Go to Images > Convert, select the image created in Step 3.

  8. In the conversion options, under "Image Format," select a .dmg format, e.g., the default option. Click Convert and save the dmg.

  9. Done!

To set a background picture: Create a hidden folder (e.g., ".background") inside the mounted image from step 4. Place your background picture in that hidden folder, then in the view options, select the picture from the hidden folder as the background.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment