2

Following steps to update a .dmg file (mounting and Show Contents), I'm unable to write to the folders in the DMG file.

Doing a "Get Info" displays a locked padlock and all else greyed out in the Sharing & Permissions section. Clicking on the padlock and entering my password does unlock the padlock but the Sharing & Permissions is still greyed out. It does show I have Read & Write and "You have custom access" (greyed out) but am not able to copy files into the contents of the DMG.

Any hints? Thanks.

2
  • i'm not overly familiar with DMG images, but disc images designed for burning to optical media (like ISO, and i presume DMG) are usually not writable. instead, to modify a disc image you'd copy the contents to a folder on the hard drive, make your changes, and then generate a new disc image. Jun 22, 2010 at 19:41
  • Doh! Of course, thanks your are correct. I was all sideways on that.
    – danfoxley
    Jun 22, 2010 at 21:00

2 Answers 2

3

Most .dmg files are read-only. A common workaround is to copy the contents of a mounted .dmg to a folder on your hard drive, and making your edits on that copy.

If for some reason that workaround won't work for you (not enough free disk space perhaps?), you can mount a read-only disk image with a "shadow file" to make it act writable. All writes are actually written to the shadow file instead of the original read-only .dmg, which is left untouched.

hdiutil attach -shadow filename.shadow filename.dmg
7
  • Is this safe though?
    – Pacerier
    Feb 22, 2018 at 0:14
  • @Pacerier This functionality has been around for a long time, I used it quite a bit without any problems around the time I wrote that Answer, and I haven't heard anyone say it's unreliable. What exactly is your concern?
    – Spiff
    Feb 22, 2018 at 1:12
  • The concern is that this is a Linux command, are you sure it works as intended for Mac?
    – Pacerier
    Mar 9, 2018 at 13:10
  • @pacerier, I’m afraid you’re mistaken. hdiutil is not in any way a Linux command. It’s an Apple proprietary command that’s only on macOS.
    – Spiff
    Mar 9, 2018 at 13:16
  • 1
    @AnoopVaidya You should probably ask your question as a real Question post rather than hoping to get answers in comments of a question from 12 years ago. I don't know that Apple has ever documented the .shadow file format. I don't know of any tools that work with it other than hdiutil. I wouldn't be surprised if you could use hdiutil to merge the read-only .dmg and the .shadow file into a writable disk image, but I haven't looked at at the hdiutil man page recently. The whole .shadow file thing was created for netbooting original Bondi-blue iMacs in 1998, and is mostly forgotten.
    – Spiff
    Jul 25, 2022 at 20:37
0

What does a .dmg file have to do with that? The screenshot is misleading. See Step 5.

2
  • Step six shows the mounted .dmg having files added by "Showing Contents", which I'm unable to do.
    – danfoxley
    Jun 22, 2010 at 20:55
  • Nevermind, seeing quack quixote and then re-reading your post, I got it. I need to copy off the content of the DMG to the desktop. Thanks for the tip.
    – danfoxley
    Jun 22, 2010 at 21:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .