讓 iTerm2 也翻牆

首先環境必須先安裝好 shadowsocks.
安裝 polipo
brew install polipo
設定 polipo
polipo
開機自啟動
atom /usr/local/opt/polipo/homebrew.mxcl.polipo.plist
在 homebrew.mxcl.polipo.plist
中加上 socksParentProxy=localhost:1080
.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>homebrew.mxcl.polipo</string>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
<key>ProgramArguments</key>
<array>
<string>/usr/local/opt/polipo/bin/polipo</string>
<string>socksParentProxy=localhost:1080</string>
</array>
</dict>
</plist>
ln -sfv /usr/local/opt/polipo/*.plist ~/Library/LaunchAgents
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.polipo.plist
若要從自啟動中取消
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.polipo.plist
設置別名
在 .zshrc
中加入以下命令:
alias proxy="export http_proxy=http://localhost:8123;export https_proxy=http://localhost:8123"
alias unproxy="unset http_proxy"
使用
啟動, 當然 SS 必須先啟動
proxy
關閉
unproxy