proxychains的作用如名字所示,将一个应用程序的tcp走proxy。可以走多个代理,像链条一样链接起来(chains),支持混合不同的代理。如:

1

like: your_host <-->socks5 <--> http <--> socks4 <--> target_host

1.编译安装

ZSH

1

2

3

4

5

6

git clone https://github.com/rofl0r/proxychains-ng.git  # download

cd proxychains-ng

./configure

sudo make

sudo make install

cp ./src/proxychains.conf /etc/proxychains.conf  # config file

2.配置文件

vim /etc/proxychains.conf

添加一行:socks5 127.0.0.1 1080(具体取决于你的ss配置)

3.alias

alias p4="proxychains"

4.使用

p4 curl www.google.com

FAQ

1.没有 work?

可能是 OSX 的保护模式的问题,可以按照 调教Mac外接显示器(开启Hdpi) 相同的方式在 OSX 的恢复模式中关闭保护 csrutil disable 。详见issue

2.出现以下警告?

1

2

3

4

dyld: warning: could not load inserted library '/usr/local/Cellar/proxychains-ng/4.13/lib/libproxychains4.dylib' into library validated process because no suitable image found.

Did find:

        /usr/local/Cellar/proxychains-ng/4.13/lib/libproxychains4.dylib: code signing blocked mmap() of '/usr/local/Cellar/proxychains-ng/4.13/lib/libproxychains4.dylib'

        /usr/local/Cellar/proxychains-ng/4.13/lib/libproxychains4.dylib: stat() failed with errno=1

因为 proxychain command 不是通过 brew 安装的,比如用 proxychains 代理 git 的时候,git 又不是通过 brew 安装的,是系统自带的那个,就会出现这个。

解决方法是将工具替换成用 brew 安装的。