Ask Different is a question and answer site for power users of Apple hardware and software. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Currently part of my build process is as follows;

  • Start Utilities/Disk Utility
  • Select New Image
  • Set Save As to widget
  • Set Name to widget
  • Set Size to custom size 50 mb
  • Set Format Mac OS Extended

but is it possible to do all this from the command line ?

share|improve this question

You can do this with the hdiutil tool. The appropriate configuration in your case would be:

hdiutil create -size 50m -fs HFS+ -volname Widget /path/to/save/widget.dmg

Obviously change the "Widget" and path to whatever you need.

A few additional options that may be useful:

  • -srcfolder /path/to/source This will create the disk image with the data in the specified folder as the contents.
  • -megabytes 50 used instead of -size 50m. This will use binary sized megabytes (2^20 bytes) instead of decimal (10^6 bytes).
  • -srcdevice /dev/diskXsY This is like srcfolder, but makes a block-based copy from another device, like a hard drive partition or DVD. Useful for making clones and images of install disks, etc.
share|improve this answer

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.