Source: Xda-developers
Requirements
Baseband should be on MDL or MDC
If you are on MF9 then you have to downgrade either MDL or MDC baseband.
Donwload MDC modem.
Use the downloaded MDC file and flash it with Odin to your Phone. Once flashed check if your baseband is MDC.
Phone SPC/MSL code.
Download SPCUtility.apk
Run it, you gotta be online for this to work.
Stock
Dial ##3424# enter your SPC/MSL and put the phone into DM + MDM + ADB mode.
BE SURE TO SET BACK MTP+ADB ONCE EVERYTHING IS DONE.
AOSP
Connect phone to computer, Enable Debugging in Developer Options.
Open command prompt/terminal, Enter adb shell,
Type su and press enter, type setprop sys.usb.config diag,acm,adb then hit enter. This mode disables itself after reboot.
Download S4-Unlocker this oneclick is developed by meanngreen04 from XDA, be sure to thank him.
Password for zip file meanngreen04
Download .net 4.5, this is required for the one click to work.
Assuming that your phone is still connected the computer run the S4 unlocker and click on Scan and Unlock.
Your phone should reboot, thats it now your phone is unlocked for GSM
You can revert back to MF9 baseband again using this modem
PLEASE DONATE TO AUTOPRIME from XDA, all credits go to him.
even 5$ is something. please do DONATE to him. i have donated.