Proxy Issues with iPhone and Mac OS X

Like all tried and true iOS developers, I love using the excellent Charles Proxy. However, I’ve been running into issues where the proxy is running while the iPhone is attached to my Mac.

Whenever I would have Charles closed and my phone plugged in, I was getting this helpful message:

Safari can't open the page because Safari
can't connect to the server"

Usually, you can fix this on Wi-Fi by going into Network > Wi-Fi > Advanced Settings > Proxies, and disabling Web Proxy (HTTP) and Secure Web Proxy (HTTPS).

Unhelpfully, however, you’ll note that the iPhone USB network interface does not include an “Advanced Settings” button.

No problem! Head to your Terminal and type in the following two lines of code:

sudo networksetup -setsecurewebproxystate "iPhone USB" off
sudo networksetup -setwebproxystate "iPhone USB" off

This disables both the secure proxy and the unsecure proxy.