Error creating disk image using hdutil

10.3k Views Asked by At

I'm trying to build dmg of .app file using following hdutil command:

hdiutil create  -srcfolder /Users/me/My.app My.dmg

It works as expected as it creates My.dmg correctly. Problem started happening when I add two more files in to .app bundle before calling that hdutil command. The hdutil ends up with error:

diskimages-helper: resize request is above maximum size allowed.
hdiutil: create failed - Invalid argument

Thanks for any help you can provide.

3

There are 3 best solutions below

7
On

I had the same problem. The solution I found at Apple Support Communities worked for me. I ended up adding an empty .Trash file into the folder before calling hdiutil:

touch root_folder/.Trash

or with Ant in my case:

<touch file="root_folder/.Trash"/>
0
On

You can optionally specify a '-size' parameter when you invoke hdiutil. If you specify a size large enough that the disk image doesn't need to be resized during .dmg creation, it seems you can avoid this error.

E.g.:

hdiutil create -size 240m -fs HFS+ -srcfolder test -volname Test test.dmg
0
On

I make images of folders like this:

hdiutil makehybrid -hfs -o output/path.dmg -hfs-openfolder input/path input/path