51

I have 2 machines: A MacBook Pro and a desktop running Fedora, I have a USB drive and a Mac OS X 10.8 dmg.

Unfortunately, the MacBook won't boot into Mac OS X, I'm trying to make a bootable Mac OS X USB flash drive to recover it.

Any insight? I've tried dmg2img but no success putting that image onto the usb drive.

Is there an easy way to do this?

Giacomo1968
  • 58,727

5 Answers5

69

Install dmg2img

sudo apt-get install dmg2img

Convert DMG image file to ISO file

dmg2img -v -i /path/to/image_file.dmg -o /path/to/image_file.iso

Copy ISO image to USB

sudo dd if=/path/to/image_file.iso of=/dev/sdb && sync

sdb is an example. In your case it might be different

Edit

You can do the conversion and actual writing in one pass, if you don't need the .iso afterwards: it will take half the time as converting to .iso and THEN writing to the USB device. Just do:

sudo dmg2img -v -i /path/to/image_file.dmg -o /dev/sdb

Again, sdb is an example. In your case it might be different.

bwDraco
  • 46,683
24

Have you tried "Acetoneiso"?

It'll convert the DMG to an ISO for you. After that, the easiest way I know of to make a bootable USB is using DD.

dd if=/path/to/osx.iso of=/dev/sdX && sync

Note: sdX is an example, you will have to check your flash drive address (usually sdb if you have only one hard disk). Do not add a partition # after that (such as sdb1). This method is a little hard on flash drives (I have killed one or two doing this relatively frequently, but once should be fine).

If you are unfamiliar, DD is a bit by bit copy and sync just verifies that all files have been written to the usb.

Nighto
  • 101
nerdwaller
  • 18,014
2

Try booting from Internet Recovery (Command + Alt + Shift + R) and opening the installer app from Terminal.

Open Terminal in recovery and:

cd /Volumes/NAME-OF-YOUR-USB-STICK/
cd The-Name-Of-Your-Installer.app/Contents/MacOS
./InstallAssistant

The installer should load.

0

None of the proposed solution worked for me. The USB flash drive was not recognized by my MacBook Pro. But the following gist definitely helped me, especially this particular comment shared below:

Hello,
I found a much easier and faster way to create a recovery. Tested with Catalina.

  1. Download https://github.com/kholia/OSX-KVM/blob/master/fetch-macOS.py
  2. Run it and select in the menu any version up to 10.15.x macOS Catalina
  3. Wait for BaseSystem.dmg to download in the same folder you run the script
  4. Run dmg2img BaseSystem.dmg. It will convert the dmg to a raw disk image BaseSystem.img
  5. Write the image to a USB key using dd or GNOME disks
  6. Boot your Mac from the USB key. It will boot into recovery where you will have the option to install mac os.

The key was to extract BaseSystem.dmg from the original ISO, then to copy it on the USB flash drive via dd (instead of copying directly the whole ISO).

Giacomo1968
  • 58,727
soywod
  • 101
-1

usually, you just write the dmg image to the usb drive

on linux:

fdisk -l # find the USB drive, for example: sdb
dd if=image.dmg of=/dev/sdb bs=16M status=progress

on macos:

diskutil list # find the USB drive, for example: disk2
dd if=image.dmg of=/dev/disk2 bs=$((16 * 1024 * 1024))
milahu
  • 297