Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I'm trying to add a few files into a dmg. How do I create a DMG file from a directory?

share|improve this question
Could you be more precise? You can create DMG with Disk Utility, do you want something to automate it (bash scripting...)? –  Loïc Wolff Apr 12 '12 at 16:07
@LoïcWolff Nope, no need to be. I didn't know that Disk Utility allowed for that. –  Moshe Apr 12 '12 at 16:15
add comment

2 Answers 2

up vote 3 down vote accepted

Some step by step instructions can be found here.

After opening Disk Utility:

  1. Click the New Image icon
  2. Place the contents of folder/directory into the newly created disk image.
share|improve this answer
add comment

If you want to do it from the command line, you can use hdiutil like so:

hdiutil create -volname WhatYouWantTheDiskToBeNamed -srcfolder /path/to/the/folder/you/want/to/create -ov -format UDZO name.dmg

Man hdiutil for more details.

share|improve this answer
Just what I was looking for! Made a bash script to help automate it for convenience: gist.github.com/AlistairIsrael/5308455 –  AlistairIsrael Apr 4 '13 at 7:15
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.