mac打开终端代理
1 打开终端代理 vim ~/.zshrc(如果没后.zshrc文件就自己新建一个)
2 然后按 i 编辑一下命令
# -------------------------------
# polipo proxy on/off
# ------------------------------
function proxy_on() {
# 配置http访问的
export http_proxy=http://127.0.0.1:1087
# 配置https访问的
export https_proxy=$http_proxy
# 配置http和https访问
export all_proxy=$http_proxy
# export PATH="/usr/local/opt/openssl/bin:$PATH"
export ftp_proxy=$http_proxy
export rsync_proxy=$http_proxy
export HTTP_PROXY=$http_proxy
export HTTPS_PROXY=$http_proxy
export FTP_PROXY=$http_proxy
export RSYNC_PROXY=$http_proxy
echo '******** 开启当前终端代理gutu ********'
}
function proxy_off() {
# 移除代理
unset http_proxy
unset https_proxy
unset all_proxy
unset ftp_proxy
unset rsync_proxy
unset HTTP_PROXY
unset HTTPS_PROXY
unset FTP_PROXY
unset RSYNC_PROXY
echo '******** 关闭当前终端代理gutu ********'
}
注意:export http_proxy=‘这里的地址请查看自己的纸飞机的地址,点击纸飞机然后进入Http代理设置把HTTP代理监听地址和端口换上去’
3 按EST退出编辑,然后 :wq退出
4 通过命令 source ~/.zshrc 保存 刷新文件
5 curl cip.cc // 查看当前的ip
6 curl http://www.gooogle.com //向url发送请求,查看时候链接代理成功