How to create a macOS installation disk on Linux
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!
Install Dmg2Img
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.
Ubuntu
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
Debian
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 Linux
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.
cd dmg2img
Lastly, use the makepkg command to build and install Dmg2Img on your Arch Linux PC.
makepkg -sri
Fedora
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
OpenSUSE
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.
OpenSUSE Tumbleweed
wget ftp://ftp.pbone.net/mirror/ftp5.gwdg.de/pub/opensuse/repositories/filesystems/openSUSE_Tumbleweed/x86_64/dmg2img-1.6.5-1.4.x86_64.rpm
OpenSUSE Leap
wget ftp://ftp.pbone.net/mirror/ftp5.gwdg.de/pub/opensuse/repositories/filesystems/SLE_12/x86_64/dmg2img-1.6.5-1.2.x86_64.rpm
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
Generic Linux
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.
lsblk
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!
Here’s an interesting combination, I have a X Server running 10.4.4, which does not have a cd burner, only the “front-load ROM drive. I also have the 4 disk set from macintoshrepository.org, in .dmg form.
Now, my linux machine is a laptop equipped with a BD-r drive, I’m wanting to burn the disk iso’s (already run through dmg2img), to physical CD-R’s. K3B (the linux cd/dvd/bd-r burning software cannot figure the file type of the iso image, Will write the image to the disc, but the disc is not readable on linux. Any tips on making a bootable Mac disc on a linux platform, or does this fall under impossible?
you likely need to install an HFS+ filesystem handler, or make sure it’s compiled into your kernel and get the utils for it.
https://docs.kernel.org/filesystems/hfs.html
you can try the FUSE hfs+ driver which is maintained, I believe. https://github.com/0x09/hfsfuse – this also has links to hfsutils
I followed at the instructions and make the USB stick, however the iMac doesn’t recognize it as a bootable partition and therefore doesn’t show the USB as a boot option. Is there a way to make the stick bootable?
You may need to try again with a different MacOS image. Sometimes the DMG2IMG tool doesn’t work with every DMG file.
How to edit Mac dmg file on Linux Platform.
https://ladydebug.com/blog/2019/03/16/how-to-edit-mac-dmg-file-on-linux-plaform/
This was very helpful. Thank you 🙂
Trying to makes bootable USB Drive to instal on a new SSD internal drive after the original one fried. I tried making one on a Linux laptop but it doesn’t Ork? Is there any chance of a USB Drive made of a non Apple m as chine ever working or not, I’m trying to avoid paying £20, I’m a pensioner, every penny counts! I have as n iPad Pro 9.7″ 1st gen but no other Apple machine with which to create the USB Drive.
Thank you.
hi, i did everything from this guide and have the usb stick ready, but how do i boot from it?right now it’s booting to linux mint directly without asking where from.
thanks