How to create a OS X Mountain Lion Bootable USB drive on Ubuntu?

78,502

Solution 1

As you want to create a LiveUSB you need a .iso image to make it. The Mac image is a .dmg file, so you must to convert this file into .iso, and then install it.

Install DMG2IMG

DMG2IMG (1, 2) will convert the .dmg image into a .iso image. To install open a terminal and enter this command: sudo apt-get install dmg2img

Convert the Image

With dmg2img you will create an .img file and this file will have the same format as an .iso file, you just need to replace the extension.

In the terminal enter the following commands or paste the script with the necessary modifications:

# Replace "OriginalFile.dmg" with the filename including the extension
# of your file. The extension will be replaced where necessary unless
# you want to specify the filenames yourself.

filename="OriginalFile.dmg"

# Replace with your file name and it will create the IMG file
dmg2img -i "${filename}" -o "${filename%.dmg}.img"

# Note that the extension of the first file is ".img"!
mv "${filename%.dmg}.img" "${filename%.dmg}.iso"

Make the LiveUSB with an ISO image

Now you already have the .iso image, with which you will make the LiveUSB. Several tools and answers exist to help you create bootable USB drives, some are specific to PC/MBR booting (Bootcamp) where Macs and newer PCs since Windows 8 require/support UEFI booting.

A related question: AskDifferent – Official way to obtain an OS X ISO file

Solution 2

why not just dd the .img file after conversion?

sudo dd if=/path/to/orig.img of=/dev/s**
Share:
78,502

Related videos on Youtube

Jake Badlands
Author by

Jake Badlands

BY DAY: Alt-Rock Ninja Cowgirl at Veridian Dynamics.BY NIGHT: I write code and code rights for penalcoders.example.org, an awesome non-profit that will totally take your money at that link. My kids are cuter than yours.FOR FUN: C++ Jokes, Segway Roller Derby, NYT Sat. Crosswords (in Sharpie!), Ostrich Grooming."If you see scary things, look for the helpers-you'll always see people helping."-Fred Rogers

Updated on September 18, 2022

Comments

  • Jake Badlands
    Jake Badlands over 1 year

    I already know how to do it on Mac OS X (plenty of instructions online).

    But is it possible to do it on Ubuntu? If yes, how?

    • Lucio
      Lucio over 11 years
      I think that your solution (Question and answer) already exist in this post.
    • Jake Badlands
      Jake Badlands over 11 years
      @Lucio Unfortunately, no. This post tells about .iso image files, but I have .dmg image file, which is different.
  • karel
    karel about 9 years
    Since you asked, dd is a good program if a bit hard to understand for some, however dd has one major drawback compared to GUI USB creator applications . Sometimes when you dd an .img file onto a USB drive you can't reformat it if you want to reuse the USB drive. The GUI live USB programs don't have this problem.
  • Jake Badlands
    Jake Badlands over 8 years
    @karel actually you could use a software like SDFormatter with FORMAT SIZE ADJUSTMENT = ON to restore the true capacity of USB drive (after dd'ing USB drive could appear as e.g. 50 MB instead of 4GB and standard built-in OS software sometimes can't restore it)
  • karel
    karel over 8 years
    @JakeBadlands I downloaded SDFormatter to try it, but ClamAV reported a malware threat on the file that I downloaded, so I'm sticking to my tried and true method which uses programs from the Ubuntu Software Center: askubuntu.com/questions/496309/how-to-unboot-my-bootable-usb‌​/…
  • Jan Segre
    Jan Segre over 6 years
    It should be possible to use parted to recreate the partition table on a dd'd USB stick. It makes sense to me that some GUI tools don't support recreating the partition table and thus are stuck with whatever size was put there when dding, but it would seem strange if it couldn't be done with parted, is this known not to work on any USB stick?