Mac – How to run ALL HTTP requests through Charles Web Debugging Proxy – including command line ones

debughttpmacnetworkingPROXY

I'm using the Charles Web Debugging Proxy software to debug HTTP requests. It works great with my desktop browsers, Chrome and Firefox, and it even sees HTTP requests that other programs make.

When I run Charles and check the network config, I think I understand how it works – it just sets up a proxy for all HTTP and HTTPS requests and then listens for these on port 8888:

enter image description here

However the item I can't figure out is that I don't see any requests that I initiate at the Terminal, such as wget, curl, or the elinks browser.

I know that I can specify the proxy with curl and wget by using 127.0.0.1:8888, but I don't understand if the network interface is set up with a proxy in the configuration why I would need to manually specify the proxy for them.

Also I can't seem to get BlueCrab (website copier) to show up in Charles either – and I don't see a proxy setting for it – although I believe it is using an XWindow wrapper or something (so it's not really a native Cocoa / Carbon app):

enter image description here

How can I get all HTTP requests on my system to run through Charles?

Clarification

My question is about the system fundamentals of why curl and wget wouldn't use a proxy when the network interface was set up to use one more so than asking about the correct syntax for curl, wget, etc.

Best Answer

VPN would create a new network device, you can see it in ifconfig command, and then route all system network to that device, you could see the route use route command.

But HTTP Proxy (in this case, the Charles) is different, it just open a port, to use it, you must specify your application setting to use that port for HTTP stuffs. and as Kevin Reid's answer, curl, wget etc don't read OS X's system wide settings.


If your proxy is SOCKS (Charles supports both HTTP and SOCKS), you could use ProxyChains or tsocks for application doesn't support proxy setting.

e.g.:

$ proxychains git clone https://github.com/rofl0r/proxychains-ng
Related Question