If you are a developer with a beta version of iPhone OS 4.0, here is a step by step guide to jailbreak your operating system. Please note that you will need
1) iPhone 3G (not 3GS),
2) Mac OS X running the latest iTunes version
3) Apple UDID
Step 2 : Install iPhone OS 4.0 on your iPhone 3G
Step 3 : The jailbreaking can be done with the help of the new RedSn0w 0.9.5 software. Download it from here (ZIP file)
Step 4 : Launch RedSn0w 0.9.5 on your iPhone. You shall be prompted to point to the firmware. Choose iPhone1,2_4.0_8A230m_Restore.ipsw
Step 5 : Follow the instructions and select ‘Install Cydia‘ and tap ‘Next‘. If you are prompted for the mode of installation, choose ‘DFU mode‘.
Step 6 : You will now need to point to a repo to install Cydia. Go to the Sources panel and enter http://apt.saurik.com/cydia-3.7
Step 7 : Follow through the installation. Cydia will now reboot your iPhone.
Step 8 : You’re done. If you see the Cydia icon on your Home Screen, you have successfully jailbroken iPhone OS 4.0 on your iPhone 3G