让终端走代理

在某些时候, mac OS 下的终端在现在这个环境下. GitHub 等网站动不动连不上, 需要走代理. 现在可以有三种方式:

  • Surge Mac 2 的增强模式
  • Proxifier 把终端设置为走代理模式
  • zsh 的配置模式

1、在Surge for Mac中,点击menu栏目,选择增强模式

2、其中可以在.zshrc的配置文件中:

1
2
3
4
5
6
7
8
9
10
11
12
13
# where proxy
proxy () {
export http_proxy="http://127.0.0.1:8888"
export https_proxy="http://127.0.0.1:8888"
echo "HTTP Proxy on"
}

# where noproxy
noproxy () {
unset http_proxy
unset https_proxy
echo "HTTP Proxy off"
}

使用的时候输入 proxy 打开代理模式,关闭代理时输入 noproxy 即可.

Comments

Your browser is out-of-date!

Update your browser to view this website correctly.&npsb;Update my browser now

×