Skip to content

Instantly share code, notes, and snippets.

@lexrus
Last active May 31, 2018 18:39
Show Gist options
  • Save lexrus/49d9f3cd50a16b1fa9df to your computer and use it in GitHub Desktop.
Save lexrus/49d9f3cd50a16b1fa9df to your computer and use it in GitHub Desktop.
LaunchCtl plist of ChinaDNS for El Capitan.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.shadowsocks.chinadns</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/chinadns</string>
<string>-c</string>
<string>/usr/local/etc/chnroute.txt</string>
</array>
<key>KeepAlive</key>
<dict>
<key>NetworkState</key>
<true/>
</dict>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
@lexrus
Copy link
Author

lexrus commented Sep 11, 2014

  1. Install chinadns:
    brew install chinadns-c
  2. Fetch a new chnroute:
    curl 'http://ftp.apnic.net/apnic/stats/apnic/delegated-apnic-latest' | grep ipv4 | grep CN | awk -F\| '{ printf("%s/%d\n", $4, 32-log($5)/log(2)) }' > /usr/local/etc/chnroute.txt
  3. Save the above plist into /Library/LaunchDaemons:
    sudo curl https://gist.githubusercontent.com/lexrus/49d9f3cd50a16b1fa9df/raw/6ee375498ec04755070df5894732e987e2e561d4/com.shadowsocks.chinadns.plist -o /Library/LaunchDaemons/com.shadowsocks.chinadns.plist
  4. Launch ChinaDNS:
    sudo launchctl load /Library/LaunchDaemons/com.shadowsocks.chinadns.plist

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment