Best possible way to edit read only DMG

File: DMGI ran into a situation of editing bootable dmg for my need, I utilized the hdiutil shadow mode for my purpose and thought share best possible way to edit read only dmg with community.

What is DMG file and what’s the purpose of it?

Advantages:

  • Preserve bootable state of dmg
  • Eliminate a space required to convert read-only dmg to read-write
  • Add, edit, delete any items on dmg
  • Less time consuming as compare to other approaches

Edit Read Only DMG

Step 1

Attach read-only dmg file using hdiutil

Note: This command takes a while depending on dmg size.

Step 2

Modifying mounted dmg, perform add, edit or delete as per your need

Step 3

Detach mounted drive [Now it is modified one] by below command or Eject it from Finder

Step 4

Converting/Writing a shadowed dmg into read-only form

Note: This command takes a while depending on  dmg size.

That’s it, we have successfully edited read only dmg file! 🙂

Tags:, ,