Have a broken Macbook or iMac? In need of a fresh macOS installation to fix it but only have access to a Linux PC? Don’t worry! Thanks to the Dmg2Img application, it’s possible to make a macOS installation disk on Linux.
Please keep in mind that the Dmg2Img application doesn’t work 100% of the time. Use at your own risk!
Before being able to create a new installation image, you must install the Dmg2Img application on your computer. In this section of the tutorial, we’ll go over how to install Dmg2Img on most Linux operating systems, including Ubuntu, Debian, Arch Linux, Fedora Linux, OpenSUSE and even from source.
To install Dmg2Img on Ubuntu, you’ll need first to enable the “Universe” software repository. To enable it, open up a terminal window and enter the following command into it.
sudo add-apt-repository universe sudo apt update
With Universe working, you’ll be able to install Dmg2Img with the Apt package manager.
sudo apt install dmg2img
Dmg2Img is available on Debian Linux in the “Main” software repository. To install it, launch a terminal window with Ctrl + Alt + T or Ctrl + Shift + T. Then, enter the following Apt-get command into the terminal window.
sudo apt-get install dmg2img
Arch users can install Dmg2Img through the AUR. To get the app installed, launch a terminal. Then, once it’s opened up, use the Pacman packaging tool to install both the Base-devel and Git packages.
sudo pacman -S git base-devel
With the packages installed, it’s time to use the git clone tool to download the Dmg2Img snapshot from the Arch Linux AUR.
git clone https://aur.archlinux.org/dmg2img.git
After the git clone command finishes up, move the terminal window into the new “dmg2img” folder on your computer.
Lastly, use the makepkg command to build and install Dmg2Img on your Arch Linux PC.
Dmg2Img is available to Fedora Linux users through the traditional software sources. To install it, launch a terminal window via Ctrl + Alt + T or Ctrl + Shift + T. Then, enter the following Dnf packaging command.
sudo dnf install dmg2img -y
Unlike a lot of other Linux distributions on this list, Dmg2Img isn’t available for OpenSUSE releases directly. Instead, if you’re looking to get the app working, you must download an RPM file from the internet and load it up.
According to our testing, Dmg2Img works fine on both OpenSUSE Tumbleweed and OpenSUSE Leap 15.0. To get the RPM downloaded, launch a terminal by pressing Ctrl + Alt + T or Ctrl + Shift + T. Then, use the wget command below.
With the RPM file downloaded, use the Zypper package manager to load up Dmg2Img onto your Linux PC.
sudo zypper install dmg2img-*.x86_64.rpm
The source code for the Dmg2Img application is up on Github. Better yet, there are detailed instructions on how to compile it from the source code. If you’re using a Linux operating system that is lesser-known, follow this link, and you’ll be able to get it going!
Burn to USB – Dmg2Img
Now that the DMG2Img application is set up, we can use it to burn a DMG file. To start, place your macOS image file on the Linux computer. Then, follow the steps below to make a bootable disk.
Step 1: Plug in a compatible USB stick into the computer. Make sure that it’s large enough — at least 8 GB in size.
Step 2: Launch a terminal window on your Linux computer by pressing the Ctrl + Alt + T or Ctrl + Shift + T on the keyboard.
Step 3: Use the Dmg2Img program to convert your macOS DMG file to a burnable ISO file. Keep in mind that
/path/to/image_file.dmg is the exact location of the DMG file on your Linux computer, and
/path/to/image_file.iso is the location you’d like to save the new macOS ISO file. Be sure to change both of those lines in the command below.
dmg2img -v -i /path/to/image_file.dmg -o /path/to/image_file.iso
Step 4: Once the Dmg2Img application is done converting your macOS DMG file to a Linux-compatible ISO file, run the lsblk command and determine what your USB’s drive label is. In this example, the drive label is /dev/sdd. Yours will differ.
Need help finding out what your USB stick’s drive label is on Linux? Check out our post about finding hard drive information on Linux! It covers how to use lsblk in detail so that you can quickly find information about hard drives and other removable devices.
Step 5: Use the DD command to burn the new macOS ISO file to the USB drive. Keep in mind that this command needs to run with sudo or it will fail!
Remember, in this example that the USB is /dev/sdd. Please make sure to replace
of=/dev/sdd in the command below to the drive label of the USB stick on your system.
sudo dd if=/path/to/image_file.iso of=/dev/sdd
When the DD command finishes writing, the terminal will be usable again. From here, unplug the USB stick from your computer and use it to re-install macOS on your Apple device!