12月03, 2020

mac终端代理配置

前提:科学上网

配置bash_profile文件

vi ~/.bash_profile

添加proxyunproxy ,注意更改端口号为自己的Socks5代理端口

alias proxy="
    export http_proxy=socks5://127.0.0.1:1086;
    export https_proxy=socks5://127.0.0.1:1086;
    export all_proxy=socks5://127.0.0.1:1086;
    export no_proxy=socks5://127.0.0.1:1086;
    export HTTP_PROXY=socks5://127.0.0.1:1086;
    export HTTPS_PROXY=socks5://127.0.0.1:1086;
    export ALL_PROXY=socks5://127.0.0.1:1086;
    export NO_PROXY=socks5://127.0.0.1:1086;"
alias unproxy="
    unset http_proxy;
    unset https_proxy;
    unset all_proxy;
    unset no_proxy;
    unset HTTP_PROXY;
    unset HTTPS_PROXY;
    unset ALL_PROXY;
    unset NO_PROXY"

更改完以后生效配置文件

source ~/.bash_profile

如何使用

启用代理

proxy

禁用代理

unproxy

本文链接:http://www.itzhouyang.com/post/mac-zhong-duan-dai-li-pei-zhi.html

-- EOF --

Comments