美文网首页
Mac iterm终端设置代理

Mac iterm终端设置代理

作者: wkjack | 来源:发表于2020-01-09 16:03 被阅读0次

1. 设置代理

使用 curl,wget,brew等http应用程序会调用http_proxy和https_proxy这两环境变量进行代理,通过下面方式设置:

方式1
export http_proxy=http://127.0.0.1:1087
export https_proxy=$http_proxy

方式2
export http_proxy=http://127.0.0.1:1087 https_proxy=http://127.0.0.1:1087

2. 取消设置代理

unset http_proxy https_proxy

3.快速切换代理

可以在 ~/.zshrc 或者 ~/.bash_profile 中添加这样的alias:

alias goproxy='export http_proxy=http://127.0.0.1:8087 https_proxy=http://127.0.0.1:8087'
alias disproxy='unset http_proxy https_proxy'

后续通过goproxy / disproxy进行切换

引用:给 iTerm 终端设置代理

相关文章

网友评论

      本文标题:Mac iterm终端设置代理

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