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%

 


Tags:

osx, dmg, converting, iso, format, isothe, couldn, linux, convert, ll, binary, download, author, website, doesn, ubuntu, repository, essential, compile, errors, install, rm, exe, gcc, cc, included, acirc, __int, int, char, block_type, declared, scope, out_offs, out_size, in_offs, in_size, convert_endian, last_offs, last_in_offs, ignoring, size_t, fread, void, attribute, warn_unused_result, downloaded, perl, edit, pl, carat, didn, successfully, partitions, decompressing, partition, conversion, corrupted, mount, hfsplus, mountpoint, fs, superblock, dev, codepage, helper, info, syslog, dmesg, modprobe, hfs, img, supercedes, bzlib, directory, lsquo, rsquo, asm, __attribute__, bz, read_kolyblk, mntcmd, read_gpt_header, read_gpt_entry, undeclared, identifier, reported, implicit, declaration, _bzdecompressinit, bz_ok, _bzcompressend, _bzdecompress, bz_param_error, bz_data_error, bz_data_error_magic, bz_mem_error, _bzdecompressend, bz_stream_end, fwrite, libbz, libssl, compiles, bytes, ok,

Latest Articles

  • python mysql install error: /bin/sh: 1: mysql_config: not found /bin/sh: 1: mariadb_config: not found /bin/sh: 1: mysql_config: not found mysql_config --version
  • FreePBX 17 How To Add a Trunk
  • Docker Container Onboot Policy - How to make sure a container is always running
  • FreePBX 17 How To Add Phones / Extensions and Register
  • Warning: The driver descriptor says the physical block size is 2048 bytes, but Linux says it is 512 bytes. solution
  • Cisco How To Use a Third Party SIP Phone (eg. Avaya, 3CX)
  • Cisco Unified Communication Manager (CUCM) - How To Add Phones
  • pptp / pptpd not working in DD-WRT iptables / router
  • systemd-journald high memory usage solution
  • How to Install FreePBX 17 in Linux Debian Ubuntu Mint Guide
  • How To Install Cisco's CUCM (Cisco Unified Communication Manager) 12 Guide
  • Linux Ubuntu Redhat How To Extract Images from PDF
  • Linux and Windows Dual Boot Issue NIC Won't work After Booting Windows
  • Cisco CME How To Enable ACD hunt groups
  • How to install gns3 on Linux Ubuntu Mint
  • How to convert audio for Asterisk .wav format
  • Using Cisco CME Router with Asterisk as a dial-peer
  • Cisco CME How To Configure SIP Trunk VOIP
  • Virtualbox host Only Network Error Failed to save host network interface parameter - Cannot change gateway IP of host only network
  • Cisco CME and C7200 Router Testing and Learning Environment on Ubuntu 20+ Setup Tutorial Guide