I recently had to do some development on the iPhone. Although the emulator is great, I wanted to test my website on an actual website. However, I did not want to do my testing on a world/company accessible location. Turns out, you can accomplish this task quite easily with Charles and OSX. Here’s how:
Step 1: Download Charles web proxy
I am typically against paying for tools, but Charles is pretty sweet. You can download it here.
Step 2: Create a personal wifi hotspot with OSX
In System Preferences go to Sharing. Within Sharing click on Internet Sharing. Select AirPort Options...:

You’ll probably want to set a password for your own wifi network. I use 40bit WEP encryption (password must be exactly 5 characters long). Click Ok when you finish.

Now select the checkbox next to internet sharing. You’ll be prompted with a warning (don’t worry about it). Click Start.

Step 3: Setup Charles Proxy Setting
You will most likely have the same install information as me, so this step is to confirm that assumption. In Charles goto Proxy > Proxy Settings...

And verify that the proxy port is 8888. Hit OK when you are done.

Step 4: Setup Proxy on iPhone
We are now ready to configure your iPhone to use the proxy. Before we can get started, you must install the Charles Proxy certificate on your iPhone. The certificate is located at:
http://charlesproxy.com/charles.crt
You will be prompted to install the certificate. Go ahead and do that! When you are done, go to Settings > Wi-Fi. Connect to the wireless network you just created (mine is called deadpool).

Once you are connected, click on the circle blue arrow to go into network settings. We need to setup our proxy information here. On the top part of the screen, get the IP address of the router. Mine is 10.0.2.1 (you will likely have the same one as me).

At the bottom of the screen under HTTP Proxy you will need to set it to manual. Then, enter the IP address you just collected and set the port to the Charles Proxy port (should be 8888).

Alternative Method: Use your assigned IP as the Proxy
I realize that it is actually a lot easier to use my existing network IP address instead of creating a hotspot. In System Preferences > Sharing > Web Sharing you will see your IP address. Enter that as the IP address as your HTTP Proxy on your iPhone (other method uses 10.0.2.1 as your HTTP Proxy).

Step 5: Go!
Visit the page in your browser. Done!

Happy debugging!