编辑 ~/.zshrc,输入(记得改成自己的代理地址):
alias proxy='export http_proxy=127.0.0.1:1088;export https_proxy=$http_proxy'
alias proxyOff='unset http_proxy;unset https_proxy'
使配置生效:
source ~/.zshrc
使用方法:
- 启动代理:
proxy - 关闭代理:
proxyOff
本教程介绍如何在 Mac 终端通过 zsh 配置代理,利用别名快速开关终端代理,适用于命令行工具的翻墙需求。
编辑 ~/.zshrc,输入(记得改成自己的代理地址):
alias proxy='export http_proxy=127.0.0.1:1088;export https_proxy=$http_proxy'
alias proxyOff='unset http_proxy;unset https_proxy'
使配置生效:
source ~/.zshrc
使用方法:
proxyproxyOff输入关键词搜索本站全部文章