Ditch O2 for the SIM of your choice
Perform the GSM Unlock
Then go to the iPhone’s General settings and set Auto-Lock to Never. Next, you’ll need to get your iPhone’s IP address on your local network. To do this, go to Settings: Wi-Fi and click on the blue arrow next to the network that you’re connected too. Write down the IP address, as you’ll need it later.
Now, open Cyberduck and click on the Open Connection button in the top left of the window. In the connection window, type the IP address that you just noted. Make sure that SFTP (SSH Secure File Transfer) is selected, and that you are using Port 22. For the username, type root, with the password of dottie.
Once connected, navigate from /private/var/root to the main directory by choosing the / item. Next, navigate to /usr/libexec and drag the file named lockdownd (the one you downloaded earlier) into it. It will ask if you want to overwrite the existing file — click on Continue to do so.
Now, in Cyberduck, drag the Unlock file from the desktop into the /Applications folder at the top of the main window. Once that’s done, turn off your iPhone and remove the SIM card, then turn your iPhone back on and choose the application on your iPhone called Unlock.
Assuming everything went smoothly, there should be a white screen that says "All files found. Ready to go. Press Start." Once you press start, it will take about 20 minutes for all the files to install.
The progress messages will appear at the top of the screen as it progress—once you see "Completed" then you’re finished. Insert a new SIM card of your choosing into your iPhone. Congratulations, you’ve just unlocked your iPhone!
To swap SIM cards in your iPhone, insert an unfolded paper clip into the small hole in the top of the iPhone, next to the headphone jack. This will open the iPhone’s SIM card slot, allowing you to remove your AT&T card and replace it with a different one.
We don’t know if future Apple iPhone updates will break this functionality. But if you’re about to embark on a foreign holiday, or if you avoid downloading those iPhone updates, this method will allow you to use the SIM cards of other cellular providers in your iPhone, provided that those providers also use the GSM cellular radio frequencies.