Extract from DMG

dmg, extract, macos

Solution

Some `.dmg` files can be extracted by using 7-zip.

$ 7z x your.dmg
$ ls
your.dmg
0.MBR
1.Primary GPT Header
2.Primary GPT Table
3.free
4.hfs
5.free
6.Backup GPT Table
7.Backup GPT Header

...and after extracted the `4.hfs` file:

$ 7z x 4.hfs

...you'll get the content of the `.dmg` file.

You could also mount the `.dmg` in Mac OS X using `hdiutil` command (which is also used by Homebrew Cask).

Please refer to this Ask Ubuntu question for more use cases on Linux.

Problem

How to extract content of DMG without mounting it? I want add autoupdate system to my application. It downloads DMG from website, then extract new version of application from it.

Original source