mac 通过clashx 配置iterm终端代理


有时候我们终端需要下载国外资源,不得不挂全局代理处理,以前用的proxifier,现在在mac m1芯片上好像用不了

1. 在 .zshrc 添加(注意端口替换成自己控制台端口号)

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
    curl www.google.com
    echo -e "\n"
    echo -e "\033[32m已开启代理\033[0m"
}

function proxy_off(){
    unset http_proxy
    unset https_proxy
    unset all_proxy
    echo -e "已关闭代理"
}

或者添加

alias proxy_on_v2="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;"
alias proxy_off_v2="unset http_proxy https_proxy all_proxy"

2.加载文件

source .zshrc

3.终端输入,查看访问情况

proxy_on

在这里插入图片描述
参与的相关issues
issues https://github.com/Dreamacro/clash/issues/592