我的最终解决方案是直接在.zshrc或者.bash_profile中添加以下语句,不需要install privoxy啥的:
function proxy_on() { export no_proxy="localhost,127.0.0.1,localaddress,.localdomain.com" export http_proxy="http://127.0.0.1:7890" export https_proxy=$http_proxy #export all_proxy=socks5://127.0.0.1:7890 # or this line echo -e "已开启代理" } function proxy_off(){ unset http_proxy unset https_proxy echo -e "已关闭代理" }7890是ClashX的默认Http_Port,可以根据自己的实际情况进行更改。
可以使用curl website验证,但不要用ping,因为ping使用ICMP协议,不支持代理。
https://www.jianshu.com/p/f1c3ca69dd53 http://www.hzy2m.com/2019/04/12/Mac-os-%E9%85%8D%E7%BD%AEIterm2%E4%BB%A3%E7%90%86/ https://github.com/Dreamacro/clash/issues/592 https://www.jianshu.com/p/05ac5d0911cc