Contact

Subscribe via Email

Subscribe via RSS/JSON

Categories

Creative Commons Attribution 4.0 International License
© Rakhesh Sasidharan

Elsewhere

macOS proxy settings

One of the things since moving to macOS is that I am a total n00b when it comes to basic networking. Yes, I have some clue thanks to my (quite dated) Linux background, but there are a lot of macOS newness too that I am unaware of. I encountered one of these today.

I was trying out the Proxyman app because I wanted to do some HTTP debugging on my Mac. I installed it, then noticed that each time I stop or quit the app it breaks my Internet. I disabled the proxy settings via the macOS network UI, and even went so far as to uninstall the proxy helper installed by Proxyman – but nothing helped. If Proxyman was running Internet worked, else not.

Then I noticed that this problem seemed to be only when I am connected to VPN (which I am on for work). Apparently that has its own separate settings. Googling on that I came across the networksetup command.

On macOS you can run a command like networksetup -listallnetworkservices to list all the network services the macOS knows of. This also lists the VPN connections. You can then look at the proxy settings of a VPN connection via commands like networksetup -getwebproxy "<vpn-name>" and networksetup -getsecurewebproxy "<vpn-name>". (The former gives the HTTP proxy settings, the latter gives HTTPS). In my case these commands showed that I still had the Proxyman proxy set for the VPN connection.

I can either disable the proxy for the VPN, or I can disable and also remove the settings. I chose to do the latter (for both HTTP and HTTPS). I also wanted to do this for all my VPN connections (I had a few, for the various regions we have offices in) so rather than do it manually I decided to loop it thus:

This finds all my connections with the word “vpn” in them, then for each it removes the HTTP proxy settings and disables the proxy and then removes the HTTPS proxy settings and disables it. Simple stuff.

macOS proxy settings by rakhesh is licensed under a Creative Commons Attribution 4.0 International License.