Creating a .DMG

lostInTransit picture lostInTransit · Dec 15, 2008 · Viewed 20.3k times · Source

I want to create a dmg file for my Mac project. Can someone please tell me how to do this? This being my first Mac project, I do not have any idea how to proceed. I also want to give the user an option of running the app on start-up. How do I do this?

Thanks.

P.S. I also want to add a custom license agreement.

Answer

dbr picture dbr · Dec 15, 2008

To do this manually:

Method 1:

  • Make a folder with the files your DMG will contain.

enter image description here

  • Open Disk Utility (It's in /Applications/Utilities/)

enter image description here

  • Go to File > New > New Image from Folder (Cmd + Shift + N)

enter image description here

  • Choose the folder containing you files
  • Make sure "Compressed" is checked, then set where you want to save the created DMG

enter image description here

enter image description here

enter image description here

Method 2:

To do things like setting a background image can be a bit convoluted (You basically add the background image to the DMG, set the windows properties to use that image, using the command line you move the background image from background.png to .background.png to make it hidden)

I would recommend iDMG, which makes things a bit less tedious.

You can also script the creation of DMGs using the command hdiutil. Something along the lines of

hdiutil create -srcfolder mydirtodmg mydmg.dmg

enter image description here

As for the custom license agreement, you should look into the tool included with the Developer Tools "PackageMaker" - it's pretty self-explanatory. It's in /Developers/Application/Utilities/