Skip to content

Instantly share code, notes, and snippets.

@jordelver
Created July 8, 2012 22:06
Show Gist options
  • Save jordelver/3073101 to your computer and use it in GitHub Desktop.
Save jordelver/3073101 to your computer and use it in GitHub Desktop.
Set the Mac OS X SOCKS proxy on the command line

Set the Mac OS X SOCKS proxy on the command line

a.k.a. what to do when your ISP starts blocking sites :(

Set the SOCKS proxy to local SSH tunnel

networksetup -setsocksfirewallproxy "Ethernet" localhost 8080

To clear the domain and port

networksetup -setsocksfirewallproxy "Ethernet" "" ""

To turn the SOCKS proxy off

networksetup -setsocksfirewallproxystate "Ethernet" off
@chinenye2017
Copy link

bro how do i buy ssh ip user ip +user +pass

@chinenye2017
Copy link

i need SOCKS for tunnel

@chinenye2017
Copy link

SSH tunnel

@luckypoem
Copy link

@ghost
today i just saw ur comment.
thank you.

@mikdatdogru
Copy link

socks5.sh

 #!/bin/bash
disable_proxy()
{
        networksetup -setsocksfirewallproxystate Wi-Fi off
        networksetup -setsocksfirewallproxystate Ethernet off
        echo "SOCKS proxy disabled."
}
trap disable_proxy INT
 
networksetup -setsocksfirewallproxy Wi-Fi 127.0.0.1 8080
networksetup -setsocksfirewallproxy Ethernet 127.0.0.1 8080
networksetup -setsocksfirewallproxystate Wi-Fi on
networksetup -setsocksfirewallproxystate Ethernet on 
networksetup -setproxybypassdomains Wi-Fi youtube.com whatismyipaddress.com  ###excluded domains. if you do not want delete this line###
echo "SOCKS proxy enabled."
echo "Tunneling..."
ssh -ND 8080 root@xxx.xxx.xxx.xxx

and then chmod a+x /path/socks5.sh

@finagin
Copy link

finagin commented Jul 23, 2019

Update this line, save as /usr/bin/socks and run:

$ socks

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