● If you have a Jailbroken iPhone 3G at 3.1.2 (but not jailbroken with Spirit) then you should create the ipsw with PwnageTool 4.0 and restore from recovery mode or DFU mode.
● If you have an out of the box iPhone 3G you should restore using a PwnageTool 4.0 ipsw using DFU mode.
● If you have a Jailbroken 3.1.3 iPhone 3G it is very possible that this can fail from recovery mode, if this failure happens you will need to restore using DFU mode.
● As an alternative to PwnageTool, you can use redsn0w on iPhone 3G (on both Windows and Mac)
IMPORTANT! Whenever you need to enter DFU mode, you will need to do so using PwnageTool.
Step One
Make a folder called "Pwnage" on the desktop. In it, you will need a couple of things. PwnageTool 4.0, found here or here
You will also need the 4.0 iPhone firmware.
4.0.0 (3G): iPhone1,2_4.0_8A293_Restore.ipsw
When downloading the IPSW file, it is best to download it with Firefox since Safari often auto extracts it!
Step Two
Double click to mount PwnageTool then drag the PwnageTool icon into the Pwnage folder.
iTunes will now restore the firmware on your iPhone. This can also take up to 10 minutes. Once done you will be rebooted into jailbroken iPhone OS 4.0!
Follow these Via....
Click Here...
For RedSnow
JailBreak 3GS on MAC
Courtesy: iClarified