# Installing an Android ROM with your Mac via Heimdall and bash Because every time I want to flash a new ROM, I forgot how I did it the last time. This is how I re-flashed my unbranded Samsung Galaxy S4 (german black edition) with a stock ROM (because Cyanogenmod crashed my phone all the time). The correct Stock ROM for my Galaxy S4 is: I9505XXUHOJ2_I9505OXAHOJ2_I9505XXUHOJ2 ## Software you need - adb - heimdall (brew cask install heimdall-suite) ## Preparing the ROM - Find any ROM that you want to flash and unzip it - If there is a xxx.tar.md5 remove the .md5 and untar the file as well, until there is a list of around 12 files in a folder (see list of required files in heimdall command below) - Now switch to your console and change into that directory ## Flashing the ROM Enter *Download mode* with *Power + Volumne Down* or: ```bash adb reboot bootloader ``` Wait until the system is in *Download mode* and then execute: ```bash heimdall flash --APNHLOS NON-HLOS.bin \ --ABOOT aboot.mbn \ --BOOT boot.img \ --HIDDEN hidden.img.ext4 \ --MDM modem.bin \ --RECOVERY recovery.img \ --RPM rpm.mbn \ --SBL2 sbl2.mbn \ --SBL3 sbl3.mbn \ --SYSTEM system.img.ext4 \ --TZ tz.mbn \ --CACHE cache.img.ext4 ``` Have fun with your new ROM! ## Known problems ### Stuck at Samsung logo Boot into recovery mode *Volume Up + Power + Home* and execute - Wipe data / factory reset - Wipe cache partition - Reboot ### Cannot get into recovery mode Flash it again from within *Download mode* ```bash heimdall flash --RECOVERY recovery.img ``` ### Heimdall "Claiming Interface Failed If you have the *Samsung Kies* software installed, this might load some intrusive kernel modules. This is how to find and get rid of them: ```bash kextstat | grep -v apple sudo kextunload -b com.devguru.driver.SamsungComposite sudo kextunload -b com.devguru.driver.SamsungACMData sudo kextunload -b com.devguru.driver.SamsungACMControl ```