工具准备
1、shadowsocks
代理客户端
2、homebrew
软件包管理工具
3、privoxy
终端翻墙工具
安装
1、安装 shadowsocks
shadowsocks
百度一下,一大堆,也可以在这里下载,购买VPN服务
2、安装 homebrew
ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)” < /dev/null 2> /dev/null
3、安装privoxy
brew install privoxy
使用privoxy
1、privoxy
配置
打开配置文件 /usr/local/etc/privoxy/config
vim /usr/local/etc/privoxy/config
加入下面这两项配置项
listen-address 0.0.0.0:8118 forward-socks5 / localhost:1080 .
第一行设置privoxy监听任意IP地址的8118端口。第二行设置本地socks5代理客户端端口,注意不要忘了最后有一个空格和点号。
2、启动privoxy
sudo /usr/local/sbin/privoxy /usr/local/etc/privoxy/config
3、查看是否启动成功
netstat -na | grep 8118
启动成功会有如下输出
tcp4 0 0 *.8118 *.* LISTEN
tcp4 0 0 127.0.0.1.8118 *.* LISTEN
4、使用
打开 .bash_profile
vim ~/.bash_profile
添加下面两项
export http_proxy=’http://localhost:8118’ export https_proxy=’http://localhost:8118’
使配置生效
source ~/.bash_profile
试一下
curl www.google.com
参考资料
http://www.cashqian.net/blog/001486989831982332565298e4942a2bb8f56b08f9d2475000