Here are instructions for connecting your iPhone via Wi-Fi diectly to the web server running on your Macintosh.
These instuctions assume that you already have Apache running on your computer, and http://localhost/ works in Safari to bring it up locally.
Make sure your network connection is coming from Ethernet (wired), not Wi-Fi (AirPort).
1. Turn off WiFi (AirPort) on your Macintosh if it's currently on. Turn Wi-Fi (back) on. If you're prompted to join any existing wireless networks, decline.
2. From the AirPort menu choose "Create Network..." Set your options and click OK.
3. In System Preferences, click on Sharing and go to the Intenet tab. If Internet Sharing is on, turn it off.
4. Check the box next to "AirPort" in the "To computers using:" list.
5. If you'd like to set options like a password, click the "AirPort Options..." button.
6. Click the "Start" button.
7. On your iPhone, go to Settings and tap on "Wi-Fi." Turn on Wi-Fi if it's off.
8. Select your computer from the list in "Choose a Network..."
9. Enter your password (from step 5, above).
10. Tap the right arrow button next to the name of your computer's network and note the "Router" IP address (probably something like "10.0.2.1").
11. Go to Safari on your iPhone and enter the router address from step 10, above.
Your iPhone should now be connected to the web server running on your computer.
-= Lunatic E'sex
This is very useful using iFireBug
http://www.joehewitt.com/blog/firebug_for_iph.php on your mac. Do the
above, and then:
* Download Firebug: http://www.getfirebug.com/releases/ibug0.1.zip to
your desktop
* Make sure that if you have the firewall on that port 1840 is open for TCP
* In terminal, "cd ~/Desktop/ibug" then "python ibug.py".
* On your iphone, don't use the URL that firebug recommends, instead
the one above (probably 10.0.2.1:1840). On the iPhone test by going to
10.0.2.1:1840/ibug.js -- you should get a web page of results
* Now, on your mac user Firefox to go to 10.0.2.1:1840/ibug.html and
you have the Firebug debugger running!
* Use <script type="application/x-javascript"
src="http://10.0.2.1:1840/ibug.js"> in pages as needed.
* Use console commands in your javacript as per
http://www.getfirebug.com/console.html , for example "console.log("The
%s jumped over %d tall buildings", animal, count);"
-- Christopher Allen