Apple has released its latest iPhone operating system, iOS 4.0, and just as quickly, the hacker community has managed to jailbreak it. For the uninitiated, "jailbreaking" refers to the ability to open up a device in order to install unapproved, third-party applications. Given both AT&T and Apple's restrictions regarding the iPhone, this process is a must for many Apple device owners.

Jailbreaking allows for a plethora of new features, including turning the phone into a Wi-Fi hotspot, being able to fully customize the phone down to its icons and forcing Wi-Fi only apps to run over 3G. For those whose older devices don't support all of iOS 4's new features, jailbreaking offers some viable alternatives. 

Jailbreaking vs. Unlocking

Jailbreaking and unlocking the iPhone are two different hacks which allow you to take control of your mobile device in different ways. Jailbreaking is a type of hack that lets you install unapproved third-party applications on your iPhone or iPod Touch from searchable repositories provided by apps like Cydia and Icy. Unlocking, on the other hand, is a hack that lets you use your iPhone on another cellular network. Here in the U.S., that means you can use the iPhone on T-Mobile instead of AT&T. You have to first jailbreak your phone before you can unlock it, but you don't have to unlock a phone in order to jailbreak it.

How to: Jailbreak iPhone 3GS on iOS 4 with PwnageTool 4.0

The "PwnageTool 4.0" jailbreak software has been updated to support baseband-preserved jailbreak for iOS 4 on iPhone 3GS. The custom .ipsw firmware files created with PwnageTool can update iPhone to iOS 4 without updating its baseband.The following step-by-step instructions will help you jailbreak your iPhone 3GS running on iOS 4 with PwnageTool 4.0.

Step 1: Download and install the latest version of iTunes 9.2.

Step 2: Now start iTunes and sync your iPhone with your PC so that it backs-up all your important data including settings, apps, music, contacts and photos.

Step 3: Download PwnageTool 4.0 and the original iOS 4.0 for your version of iPhone 3GS (download links given below). Move all these files to your desktop.

Step 4: Start PwnageTool 4.0 and select your device:

Step 5: PwnageTool 4.0 will now automatically detect the correct firmware for your device as shown in the screenshot below:

Step 6: Click on "No" when PwnageTool asks you "Do you have an iPhone contract that would activate normally through iTunes?": Clicking on “Yes” will update your baseband to the latest version. Click on "Yes" only if you are on an officially supported carrier like AT&T.

Step 7: PwnageTool will now create the custom .ipsw file for your iPhone which will be jailbroken. Click the build button to select it, then click the blue arrow button to proceed.

Step 8: Restore the firmware on iPhone with iTunes

Once the .ipsw file has been created, you will now have to restore your iPhone to this custom firmware 4.0 that you just cooked using PwnageTool 4.0 for your iPhone 3GS. Click on your phone icon from the sidebar in iTunes. Now press and hold left "alt" button ("Shift" button on Windows) on the keyboard and then click on "Restore" (Not "Update" or "Check for Update") button in the iTunes and then release the "Shift" button.

Now sit back and enjoy as iTunes does the rest for you. Just wait while iTunes installs the new firmware 4.0 on your iPhone .

How to: Unlock iPhone 3GS Baseband on iOS 4 with UltraSn0w

Once you are done with the jailbreak, you can now unlock your iPhone 3GS running custom iOS 4.0 firmware by using ultrasn0w 0.92.1 from Cydia. To do this:

Step 1: Start “Cydia” on your iPhone.

Step 2: Touch on “Manage” tab on the bottom.

Step 3: Touch on "Edit" and then on "Add". You will be prompted to enter a url source. Type ""

Step 4: Cydia will now automatically update your sources. After installation is completed. Search for “ultrasn0w 0.92” in Cydia and install this application. This app will automatically unlock your iPhone 3GS so that you can use it with any carrier.

After the installation is done, iPhone will restart automatically and you should now have a fully jailbroken and unlocked iPhone 3GS running on iOS 4.