How to create a custom dmg installer on mac

This is an example of what we gonna do :

example dmg

1 - Create a dmg with all the files that need to be installed. Maybe you can create a custom icon for your dmg to give it a more professional look. (We'll name this dmg "application"). Mount the dmg by double-clicking on it.

2 - Now we're going to create a second dmg (in this case we'll name it "app-installer"), the one we gonna burn onto a cd, or make available for download online.

3 - It's the app-installer dmg we're gonna customize.


Create a folder inside the mounted dmg and name it "background". In this folder you can drop your custom background-image for the dmg. Be careful, the image has to be inside the dmg, otherwise when switching onto another system, the image will not be visible. If you don't want a background, you can also just pick a color or leave it white. At this point we can add the "application", just drop the dmg into the "app-installer".

4 - Off course we don't want to see the background-folder in the dmg but before we do that, we need to make some changes in the View Panel of the dmg. (You can easy acces it by pressing Command + J). Be sure to choose "This window only" or you will customize all your folders.

view options

5 - You can change the font size and the dimensions of the icons (104x104 pixels looks good). Choose for ‘Picture’ and select your custom image inside your dmg. Maybe you need to scale the window so it's fits the image.

6 - Now when you have Apple Developer Tools on your system it's very simple to hide the background-folder. Open the terminal window (you can find that under "Utilities") and type :

/Developer/Tools/SetFile -a V /Volumes/your_volume/folder_to_hide

your_volume : in this case, "app-installer"
folder_to_hide : in this case, "background"

7 - Now we have to add a shorcut to the Application Folder and place it inside the dmg.

application shortcut

8 - Go to utilities, select the dmg and choose "convert", then "compression" and save again. Now the dmg is compressed (as small as possible) and made unwritable.

dmg convert

9. We're done. Test the installerby dragging the application to the shortcut. It will copy all your installation files, just like set up in the application dmg.