Post

macOS 终端 Terminal 走代理

macOS 终端 Terminal 走代理

设置 Http 代理

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

设置 Socks5 代理

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

取消代理

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

使用方法

1
2
proxy  # 开始使用代理
unproxy  # 停止使用代理
This post is licensed under CC BY 4.0 by the author.