This post should help you recover an AT&T Galaxy S4 SGH-I337 back to stock 4.4.2 using a modern 64 bit version of OS X, I tried 32 bit 10.6.8 and Heimdall wouldn’t run, so I presume you need OS X 10.7 64bit and above to run Heimdall.
First off, you need to uninstall Samsung Kies so Heimdall has USB access to the S4 drivers, it will require a reboot and possibly command line uninstalls:
Secondly, you need your recovery file. I used the big ass stock file from Stockroms (dot) net /file /GalaxyS4 /SGH-I337 /4.4.2 /”the big one there”. You’ll need to rename it to just .tar, then untar that file, and put it in a folder from which you’ll run Heimdall.
Third, install Heimdall.
Read through this post over on XDA:
Follow the OP’s steps, but see 8d) below:
linus$ heimdall flash --RECOVERY recovery.img --SYSTEM system.img.ext4 --HIDDEN hidden.img.ext4 --BOOT boot.img linus$ heimdall flash --MDM modem.bin --APNHLOS NON-HLOS.bin --ABOOT aboot.mbn --TZ tz.mbn linus$ heimdall flash --CACHE cache.img.ext4 --PERSDATA persdata.img.ext4 linus$ heimdall flash --SBL1 sbl1.mbn --SBL2 sbl2.mbn --SBL3 sbl3.mbn --RPM rpm.mbn
Sudo doesn’t seem necessary. I added that 4th line per Trevor7. Thanks to tom_callahan for the original post, for which all things considered made this quite painless for an Android wipe.
As the original poster said, each push will require a boot back into Odin’s Download Mode, hold the ‘volume down & home’ buttons in between reboots as soon as the screen goes black, then press volume up to ‘continue’. After step #4 you’ll want to boot to the stock Recovery Mode (volume up on boot) and do a “Factory Reset / User Data Wipe”; this will insure you’re good to go.
It should boot to an AT&T logo with a startup sound, it will take a couple of minutes, then you should be back to stock TouchWiz / AT&T bloated stock 4.4.2. Godspeed.
Update: I updated the above lines. It should be noted I’ve had issues with the GPS since this flash. I have been able to make it work again using a GPE “vanilla” edition with a modified TW kernel, but it’s unclear why the GPS wouldn’t work on what should’ve been a fully stock ROM (NB1 vs NC1 rootability or kernel incompatibilities?). There is apparently a way (using Windows and Samsung KIES) to do a full recovery per the manufacturer. I haven’t tried this method yet. For the time being, I was excited to have GPS working, albeit with a fairly unstable AOSP/GPE/Vanilla ROM. My hope of hopes would be to get this back to fully stock 4.4.2 NB1 and sell it, fully functional 100%. That may be wishful thinking.