Macos Terminal Set Shadowsocks   2017-10-19


  1. first, you need to have vps
  2. second, you need to have shadowsocks app

install

brew install polipo

config

设置每次登陆启动polipo

ln -sfv /usr/local/opt/polipo/*.plist ~/Library/LaunchAgents

修改文件 /usr/local/opt/polipo/homebrew.mxcl.polipo.plist 设置parentProxy

<?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>
<!-- Set `ulimit -n 20480`. The default OS X limit is 256, that's
not enough for Polipo (displays 'too many files open' errors).
It seems like you have no reason to lower this limit
(and unlikely will want to raise it). -->
<key>SoftResourceLimits</key>
<dict>
<key>NumberOfFiles</key>
<integer>20480</integer>
</dict>
</dict>
</plist>

修改的地方是增加了 <string>socksParentProxy=localhost:1080</string>

start / stop

launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.polipo.plist
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.polipo.plist

setting profile

vim ~/.zshrc

#export http_proxy=http://localhost:8123
alias hp="http_proxy=http://localhost:8123"

source ~/.zshrc

test

➜ hp curl ip.cn
当前 IP:97.64.**.** 来自:美国

reference article


分享到:


  如果您觉得这篇文章对您的学习很有帮助, 请您也分享它, 让它能再次帮助到更多的需要学习的人. 您的支持将鼓励我继续创作 !
本文基于署名4.0国际许可协议发布,转载请保留本文署名和文章链接。 如您有任何授权方面的协商,请邮件联系我。

Contents

  1. install
  2. config
  3. start / stop
  4. setting profile
  5. test
  6. reference article