Using a Mac OSX DMG Image in Windows and Converting to Standard ISO Format use dmg2iso

The dmg format is silly and annoying to work with, why couldn't Apple stick with the .iso standard?  Anyway, there's an excellent Linux and Windows based tool to convert it back to a normal .iso Image called dmg2iso

I'll only cover the Linux version although the Windows pre-built binary works the same way.

Download dmg2iso here for free (from the author's website)

It's just silly and doesn't make sense that Ubuntu doesn't have this in the repository at all, it's such a useful and almost essential tool.

For some reason I'm getting dmg2iso compile errors on my Ubuntu 8.04 install:

rm -f *.o dmg2iso.exe
gcc -O3 -c dmg2iso.cc
In file included from dmg2iso.cc:23:
dmg2iso.h:45: error: â__int32â does not name a type
dmg2iso.cc: In function âint main(int, char**)â:
dmg2iso.cc:117: error: â__int32â does not name a type
dmg2iso.cc:122: error: â__int32â does not name a type
dmg2iso.cc:123: error: â__int32â does not name a type
dmg2iso.cc:124: error: âblock_typeâ was not declared in this scope
dmg2iso.cc:126: error: âout_offsâ was not declared in this scope
dmg2iso.cc:127: error: âout_sizeâ was not declared in this scope
dmg2iso.cc:128: error: âin_offsâ was not declared in this scope
dmg2iso.cc:129: error: âin_sizeâ was not declared in this scope
dmg2iso.cc:130: error: âconvert_endianâ was not declared in this scope
dmg2iso.cc:140: error: âlast_offsâ was not declared in this scope
dmg2iso.cc:158: error: âlast_in_offsâ was not declared in this scope
dmg2iso.cc:161: error: âlast_offsâ was not declared in this scope
dmg2iso.cc:172: error: âlast_offsâ was not declared in this scope
dmg2iso.cc:172: error: âlast_in_offsâ was not declared in this scope
dmg2iso.cc:84: warning: ignoring return value of âsize_t fread(void*, size_t, size_t, FILE*)â, declared with attribute warn_unused_result
make: *** [dmg2iso.o] Error 1

Instead I just downloaded the perl version.  Make sure you edit the .pl file to point to the correct path to the perl binary.  Also if you get carat M at the end of each line, remove the carat M on the first line or it will always complain perl does not exist.

 Unfortunately this tool didn't actually successfully convert the dmg image:

 

reading property list...found 6 partitions
decompressing:
partition 0
partition 1
partition 2

Conversion failed.File may be corrupted.

 

I also tried the trick of:

mount -o loop -t hfsplus file.dmg /mountpoint

but it didn't work

mount: wrong fs type, bad option, bad superblock on /dev/loop0,
       missing codepage or helper program, or other error
       In some cases useful info is found in syslog - try
       dmesg | tail  or so

And yes I did modprobe hfsplus and modprobe hfs with no luck unfortunately.
 

 ====================================================================

Use dmg2img instead of dmg2iso, dmg2img is the one that supercedes the dmg2iso

I just found this out, but I'm getting an error during make:

 

cc -O2 -Wall -c dmg2img.c
In file included from dmg2img.c:30:
dmg2img.h:19:19: error: bzlib.h: No such file or directory
In file included from dmg2img.c:30:
dmg2img.h:34: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘bz’
dmg2img.h: In function ‘read_kolyblk’:
dmg2img.h:140: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result
In file included from dmg2img.c:32:
mntcmd.h: In function ‘read_gpt_header’:
mntcmd.h:11: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result
mntcmd.h: In function ‘read_gpt_entry’:
mntcmd.h:17: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result
dmg2img.c: In function ‘main’:
dmg2img.c:327: error: ‘bz’ undeclared (first use in this function)
dmg2img.c:327: error: (Each undeclared identifier is reported only once
dmg2img.c:327: error: for each function it appears in.)
dmg2img.c:456: warning: implicit declaration of function ‘BZ2_bzDecompressInit’
dmg2img.c:456: error: ‘BZ_OK’ undeclared (first use in this function)
dmg2img.c:471: warning: implicit declaration of function ‘BZ2_bzCompressEnd’
dmg2img.c:482: warning: implicit declaration of function ‘BZ2_bzDecompress’
dmg2img.c:484: error: ‘BZ_PARAM_ERROR’ undeclared (first use in this function)
dmg2img.c:485: error: ‘BZ_DATA_ERROR’ undeclared (first use in this function)
dmg2img.c:486: error: ‘BZ_DATA_ERROR_MAGIC’ undeclared (first use in this function)
dmg2img.c:487: error: ‘BZ_MEM_ERROR’ undeclared (first use in this function)
dmg2img.c:488: warning: implicit declaration of function ‘BZ2_bzDecompressEnd’
dmg2img.c:499: error: ‘BZ_STREAM_END’ undeclared (first use in this function)
dmg2img.c:220: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result
dmg2img.c:285: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result
dmg2img.c:516: warning: ignoring return value of ‘fwrite’, declared with attribute warn_unused_result
dmg2img.c:532: warning: ignoring return value of ‘fwrite’, declared with attribute warn_unused_result
dmg2img.c:546: warning: ignoring return value of ‘fwrite’, declared with attribute warn_unused_result
make: *** [dmg2img.o] Error 1

Make sure you install libbz2-dev and libssl-dev

Now it compiles and seems to be working unlike dmg2iso:

 

reading property list, 1839654 bytes from address 7198731606 ...

decompressing:
opening partition 0 ...             100.00%  ok
opening partition 1 ...             100.00%  ok
opening partition 2 ...             100.00%  ok
opening partition 3 ...              52.86%

 

Latest Articles

  • prosody xmpp server "Failed in all attempts to connect to proxy.eu.jabber.org"
  • VMWare ESXi 6.7 SSH/PowerShell CLI Commands
  • VMWare Vsphere VCSA Graphical Install Creates json
  • error while loading shared libraries: libasound.so.2: cannot open shared object file: No such file or directory
  • ./xmr-stak: error while loading shared libraries: libmicrohttpd.so.10: cannot open shared object file: No such file or directory
  • qemu-img resize howto
  • gmail.com address failing in Postfix
  • VMWare Hardware virtualization is selected and cannot be deselected due to selection of VBS Insufficient resources to satisfy configured failover level for vSphere HA.
  • Debian Mint Ubuntu compiling xmr-stak
  • ./nsgpucnminer: error while loading shared libraries: libOpenCL.so.1w: cannot open shared object file: No such file or directory
  • *** These critical programs are missing or too old: gawk
  • migration/4 migration 4 is using too much CPU
  • convert.im6: Unknown field with tag 317 (0x13d) encountered. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/788.
  • Python SyntaxError: Missing parentheses in call to 'print'
  • Linux How To Rename Files
  • OpenVZ container will not stop Child 546246 exited with status 1
  • [warn] VirtualHost 10.2.5.101:443 overlaps with VirtualHost 10.2.5.101:443, the first has precedence, perhaps you need a NameVirtualHost directive
  • Ethereum Client Errors
  • PayPal IPN Failed "result: IPN Handshake Invalid"
  • Linux Centos 7 HowTo Install Yarn