This is a guide geared towards iPhone users with Mac OS X. The steps are exactly same as they are on a Windows system. You can find the Windows version of the guide here.
The newly released iPhone 3.1.3 firmware for iPhone and iPod touch updates baseband to 05.12.01 on iPhone 3GS and iPhone 3G, hence making it impossible for these two devices to get unlocked using blackra1n with blacksn0w. Fortunately for iPhone 2G (the first generation iPhone with EDGE) users, the baseband remains intact. The iPhone DevTeam has just confirmed that their newly released jailbreaking tool called redsn0w 0.9.3 can be used to jailbreak and unlock iPhone 2G on firmware 3.1.3, provided that you have jailbroken it previously at least once.