Socks5 Proxy Setup in Mac Terminal
Setting up a socks5 proxy in Mac Terminal can help us manage the proxy more flexibly when making network requests from the command line, here are the steps to set up a socks5 proxy.
First, we need to open a terminal and enter the following command to set up the socks5 proxy:
"`bash
export all_proxy=socks5://127.0.0.1:1080
“`
This command means to forward all network requests through a local socks5 proxy on port 1080. If you need to set up a protocol-specific proxy, you can use a similar command, just replace all_proxy with http_proxy, https_proxy, etc.
Next, we can use the curl tool to test if the proxy is set up successfully:
"`bash
curl ipinfo.io
“`
If the returned IP address is the same as the address set by the proxy, the proxy is set successfully.
Mac terminal socks5 proxy setup tutorial
In practice, we may encounter socks5 proxies that require authentication, in which case you can use the following command to set up a socks5 proxy with a username and password:
"`bash
export all_proxy=socks5://username:password@proxy_ip:proxy_port
“`
Where username and password are the username and password of the proxy respectively, proxy_ip and proxy_port are the IP address and port number of the proxy server respectively.
Alternatively, we can write the proxy settings to a .bashrc file to make them permanent:
"`bash
echo 'export all_proxy=socks5://127.0.0.1:1080' >> ~/.bashrc
“`
This will automatically load the proxy settings every time you open the terminal.
Overall, setting up a socks5 proxy in Mac Terminal is very simple and can be easily accomplished with just a few commands. I hope this tutorial is helpful.