npm install kneesocks -g
- Make sure you edit the port number in
com.dev.proxy.plist
- Put
com.dev.proxy.plist
at~/Library/LaunchAgents
- Run
sudo launchctl unload -w ~/Library/LaunchAgents/com.dev.proxy.plist
to enable this service - Edit
~/.bash_profile
and add those 2 lines - Use
npm-proxy
andnpm-direct
to toggle proxy for npm
Last active
November 22, 2016 17:25
-
-
Save bitinn/f6b3df6d7ac52acd94ea646c675439de to your computer and use it in GitHub Desktop.
Using kneesocks as bash command
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias npm-proxy='launchctl start com.dev.proxy' | |
alias npm-direct='launchctl stop com.dev.proxy; npm config delete proxy; npm config delete https-proxy' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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.dev.proxy</string> | |
<key>ProgramArguments</key> | |
<array> | |
<string>sh</string> | |
<string>-c</string> | |
<string>npm config set proxy http://127.0.0.1:10002; npm config set https-proxy http://127.0.0.1:10002; kneesocks 10002 10001</string> | |
</array> | |
</dict> | |
</plist> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For reference: https://github.com/bitinn/kneesocks