Mac iterm终端设置代理

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 终端设置代理

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容