7

How do I convert DMG files to IMG files? I am trying to use 'Q emulator' to run XPpro and it requires an IMG file of the XP disc.(legal copy) I'm using a late model G5 PPC with Leopard 10.5.8

3 Answers 3

10

According to a very old source [circa 2006]

In Terminal,

hdiutil convert disk.dmg -format RdWr -o disk.img

where disk.dmg is the path to your image (input) and disk.img the output image

4
  • 2
    This works in 10.11 El Capitan. Commented Oct 21, 2015 at 2:33
  • 1
    Gives me hdiutil: convert failed - image/device is too large :'(
    – Toby
    Commented Mar 23, 2017 at 18:51
  • This command has worked for me on macOS Sierra, but the .img file is 4x larger than the dmg. Which I presume is normal? Commented Aug 14, 2017 at 19:13
  • this doesn't work on Sonoma
    – MIT
    Commented Oct 21, 2023 at 6:25
2

Try this instead

hdiutil convert <input.dmg> -format UDTO -o <output.img>
0
2

This is sort of a brute force method.

If writing a script, then use the commands below.

NODE="$(hdiutil attach -nomount <input.dmg>)"
echo "$NODE"
NODE="${NODE%% *}"
dd if="${NODE/disk/rdisk}" bs=1m of=<output.img>
hdiutil detach "$NODE"

Otherwise, if entering by hand, then follow these steps.

  1. Enter the command below to attach. From the ouput, note the /dev node assign to the image. Here I will assume this is /dev/disk2.
    hdiutil attach -nomount <input.dmg>
    
  2. Write the contents.
    dd if=/dev/rdisk2 bs=1m of=<output.img>
    
  3. Eject.
    hdiutil detach disk2
    

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .