美文网首页
Mac + ClashX终端代理

Mac + ClashX终端代理

作者: lele8446 | 来源:发表于2022-04-29 10:41 被阅读0次

安装有ClashX,且没有修改默认的代理配置

  1. 进入路径 ~/Users/用户名
  2. 找到.bash_profile文件,编辑
#设置代理
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 "已关闭代理"
}

保存并退出

  1. 在终端输入以下命令使其生效
source .bash_profile
  1. 开启/关闭代理
    终端:
proxy_on
proxy_off

相关文章

网友评论

      本文标题:Mac + ClashX终端代理

      本文链接:https://www.haomeiwen.com/subject/xnqsyrtx.html