MacOS – Add/Delete/Modify files within a Disk Image (.dmg)

disk-utilitydmgmacos

I know this may stem from a fundamental misunderstanding of the way disk images are intended to work, but even when full permissions are granted on a .dmg file, I am unable to add or remove files on the mounted disk image. Is there any way (natively or via a 3rd-party tool) to do this?

I know that when a disk image is mounted, a checksum verification is done, so I'm guessing that because modifying the image at all would destroy the checksum, this is inherently not allowed, but I'm wondering if there's a utility that could re-image the disk with a subset of its contents, perhaps recalculating the checksum in the process.

NOTE: Copying all the contents over, deleting, and then re-imaging is not a plausible option, due to the size of the image and the fact that it already fills most of the available space of the external drive on which it resides.

Best Answer

A disk image is designated as read-only or read-write when it is created. Simply changing the permissions on the DMG file will have no effect.

Here is one purported solution that I have not tried myself, that uses the hdiutil convert command to make a disk image writable, and hdiutil resize to add extra space if required for any additional content.