Make DMG Readonly

5

3

There is information on how to do the opposite (which is hard to impossible), but how do I make a writeable DMG readonly?

The reason that I might want to do this -- because otherwise this question is too short and will not meet superuser quality standards -- is that I am distributing a DMG and I don't want it altered TOO easily.

Dan Rosenstark

Posted 2012-02-17T03:08:36.370

Reputation: 5 718

Answers

6

hdiutil convert /path/to/rwimage.dmg -format UDRO -o /path/to/readonlyimage.dmg

There are a number of other format options (with e.g. various kinds of compression); see the hdiutil man page for details.

Gordon Davisson

Posted 2012-02-17T03:08:36.370

Reputation: 28 538

What if I don't care about the type of compression? Or must I match the compression of the existing DMG? +1 and thanks – Dan Rosenstark – 2012-02-17T07:51:48.287

Apple seems to regard zlib compression (-format UDZO) as the "default", so I'd go with that. There's no need to match the existing compression, especially since RW images aren't stored compressed. – Gordon Davisson – 2012-02-17T15:22:04.280