How to create a disk image of an entire directory on macOS

Updated April 04, 2021 · Published July 10, 2014

You can use hdiutil to manually create a disk image of an entire directory or folder by using the command below. Be sure to replace Untitled with a name for your volume, /folder/path to the directory you would like to create an image of, and filename with the file name you would like to create.

Create a disk image of a directory

hdiutil create -volname Untitled -srcfolder /folder/path -ov filename.dmg