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

  • Centos 7 - Convert Minimal to Graphical GUI GNOME or KDE Desktop
  • AMD Set Fan Speed and Other Powerplay Memory/CPU Timings with a Linux script
  • Ethereum Mining Claymore Nanopool Error
  • genisoimage errors with long filenames and deep directory structures
  • Linux Kernel USB Export Errors
  • How to download gajim 0.16.9 XMPP/Jabber client so you can use OMEMO encryption
  • HP DL385 G7 Linux BIOS Update Flash
  • hwloc-nox set CPU affinity in Linux
  • Firefox An error occurred during a connection to some-ip-or-domain. SSL peer reports incorrect Message Authentication Code. Error code: SSL_ERROR_BAD_MAC_ALERT Solution
  • Proxmox understanding the directory structure and why an NFS datastore appears to be missing files/isos
  • pandoc convert markdown to html
  • Proxmox error uploading an iso solution
  • Cannot install moodle
  • MySQL change for Antelope format to Barracuda error solution
  • vmkping -I vmk1 10.0.2.69 PING 10.0.2.69 (10.0.2.69): 56 data bytes sendto() failed (Host is down)
  • gvfs mount in /run/user cannot be accessed or displayed wrong permissions
  • VMWare vSphere 6.7 Errors Solution 503 Service Unavailable (Failed to connect to endpoint:
  • How To Enable Nested KVM so guests can virtualize with hardware extensions
  • vi error solution E166: Can't open linked file for writing
  • Supermicro IPMI / KVM / BMC Remote Console Screen Resizing Issue - Window Cut Off Solution