DMG tutorial

How to make a DMG installer for a macOS app

You will need

  • Your macOS application
  • (optional) A background image
  • 10 minutes

Steps

  1. Right click your app and look at its size. Note this down or remember it as {TOTAL_SIZE}. If you have a background image, add its size to {TOTAL_SIZE} as well

  2. Launch Disk Utility

  3. File > New Image > Blank Image...

  4. Field name Value
    Save As {APP_NAME}_installer_RW
    Name {APP_NAME}_installer
    Size {TOTAL_SIZE} (round to 10MB ceiling)
    Format Mac OS Extended (Journaled)
    Encryption none
    Partitions Single partition - GUID Partition Map
    Image Format read/write disk image
  5. Save it to Desktop

  6. Open the Drive you just created and put your macOS application in it by dragging

  7. Create a shortcut (an alias) of your Applications folder on your desktop by navigating to the folder containing the Applications folder, pressing and holding both the alt and command keys and dragging it directly to your Desktop

  8. Put this shortcut to your Applications folder in the Drive by dragging

  9. (optional) Put your background image in the Drive by dragging

  10. (optional) Right-click the blank space in the Drive and select Show View Options

  11. (optional) Background > Picture and drag the image to the box

  12. (optional) If you have set the background image, resize the window accordingly to match that image

  13. (optional) Make sure Sort By: is set to None instead of Snap to Grid, and change the Icon Size to whatever is appropriate for your background image

  14. (optional) Move your icons to whereever they should go depending on the background image

  15. (optional) Hide your image file by launching Terminal and using the command cd /Volumes/{APP_NAME}_installer_RW.

    After that use the command mv {IMAGE_NAME} .{IMAGE_NAME} (prefronting the image name with a period)

  16. Close the Drive and Right-click > Eject

  17. Launch Disk Utility again

  18. In Disk Utility, do Images > Convert...

  19. Select the dmg file you just created with the name {APP_NAME_installer_RW.dmg.

  20. Field name Value
    Save As {APP_NAME}_installer
    Encryption None
    Image Format read-only
  21. Convert

    Your DMG file has been created!

    You may now delete the {APP_NAME}_installer_RW.dmg file.