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.

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
add comment

1 Answer 1

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
add comment

Your Answer

 
discard

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.