Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'd like to be a man-in-the-middle between my iPhone and the internet for debugging purposes. In particular, I'd like to convince my iPhone that a particular host on the internet is my local development machine, and that it should not actually connect out to the net (so the app believes it's contacting a production server when in fact it's hitting a local box).

I can disable 3G and use my Mac's ad-hoc WiFi, but adding /etc/hosts entries of course won't route requests to the local machine, since it's just doing NAT, not handling DNS or other protocols on behalf of the phone.

The only thing I can think of is to jailbreak it and mess with the hosts file on the device, but I'd rather not do that if I can avoid it. Can anyone think of another way of going about this?

share|improve this question
Future readers: Set a HTTP proxy in your iPhone's network settings, using your Mac's IP. And on your Mac, install and run mitmproxy. There's a good guide here: – Collin Allen Oct 21 '15 at 20:34
up vote 6 down vote accepted

Setup a DNS server on your mac, configure your router to use your mac as it's DNS server and create DNS entries that point to where you want them.

share|improve this answer
Oh, I can't believe it didn't think of that :). I might go a little bit simpler and just configure the device directly to use a DNS server on my Mac instead if getting the router involved, but the idea will work nonetheless. Thanks! – Collin Allen Dec 4 '10 at 4:36

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.