macOS 终端 Terminal 走代理

设置 Http 代理

echo "alias proxy='export all_proxy=http://${proxy_addr}:${port}'" >> ~/.bash_profile && source ~/.bash_profile

设置 Socks5 代理

echo "alias proxy='export all_proxy=socks5://${proxy_addr}:${port}'" >> ~/.bash_profile && source ~/.bash_profile

取消代理

echo "alias unproxy='unset all_proxy'" >> ~/.bash_profile && source ~/.bash_profile

使用方法

proxy  # 开始使用代理
unproxy  # 停止使用代理
发布了382 篇原创文章 · 获赞 94 · 访问量 30万+

猜你喜欢

转载自blog.csdn.net/xs18952904/article/details/89636024