Help me with making macOS USB on Ubuntu?

The macOS partition in my Mac is corrupted and now all I have is a Ubuntu. I'm trying to make a Mac OS USB disk from Linux and I'm stuck without much options. I read here that if download DMG files for Mac you can make macOS USB in Windows. Is there any tool/method for this on Ubuntu 18.04?


The software to convert a DMG to an IMG is dmg2img and an IMG is basically an ISO:

Install:

sudo apt-get install dmg2img

Converting to IMG:

dmg2img {file}.dmg
  • you will end up with {file}.img

Burn it to an unmounted USB:

sudo umount /dev/sd{Y} 
sudo dd bs=4M if={file}.img of=/dev/sd{X}
  • replace {file} to your filename
  • replace {Y} to the letter of your USB pendrive
  • df -h will list the pendrive when it is mounted so you can find {Y} there.