Last Updated: 20 Oct 2023

   |   

Author: 135.181.114.235

Setting up a SOCKS proxy in Mac OS X

If you're somewhere that has a network that is partly blocked, but allows SSH, or if you are in a coffee shop or something similar and are worried about security, you can setup a SOCKS proxy to route all your traffic via a remote server that you control, and then out onto the Internet.

Setup SOCKS proxy

First, you need to SSH to the remote machine with some special parameters:

ssh -vND 8888 user@host.com

Some detail on those options:

-v verbose mode; useful for debugging
-N don't start an interactive shell on the remote server
-D setup the SOCKS proxy on port 8888 on localhost

Configure Proxy Settings - OS Level

Now, go into your Network Control Panel, and then 'Advanced…' → 'Proxies'. Set the SOCKS Proxy (only) with your proxy settings: localhost / 8888. You DO NOT want to set the HTTP proxy, HTTPS proxy, etc.

From here, all your apps that are proxy aware (most of them, probably) will 'just work'.

Configure Proxy Settings - Firefox Only

In some cases, you may not want to mess around with the system settings, especially if you just have something quick you need to do. In that case, Firefox allows you to configure it's proxy settings separately from the rest of the OS.

Go to 'Preferences' → 'Advanced' → 'Settings…' → 'Manual proxy configuration'. The key here is that you want to fill in ONLY the SOCKS host and port, and not the HTTP proxy, etc. As above, the settings are localhost and port 8888 (assuming you followed the example SSH command above).

Test

Once you've got things setup, go to http://www.myipaddress.com/ and double check that you're seeing the IP address of the remote machine (e.g. host.com in the example above). If you are, you're good to go… you're routing all traffic via the proxy!

Discussion

test203.90.239.220, May 14, 2015 02:55 PM

There is a Mac OS X GUI tools:

http://huoxy.github.io/

:-)

test135.84.177.135, Jan 13, 2016 05:20 PM

hello,
how do i get specific socks?
i've been asking forums after forums…noing
can you help?

test5.2.203.61, Sep 4, 2018 07:44 AM

Why do I get the ERR_SOCKS_CONNECTION_FAILED error?

I have tried to check the IP address on both http://www.myipaddress.com/ and https://www.xmyip.com

test66.199.49.66, Aug 7, 2019 01:21 PM

When I boot up my MacBook, the SOCKS proxy automatically initiates, and when it does, it prevents my Outlook from accessing our server. Why does it do this and how can I keep it from initiating at startup? Thanks

Enter your comment. Wiki syntax is allowed: