Sometimes I need to use ShadowsocksX to bypass GFW, but ShadowsocksX will clear my proxy configuration file.

When I come to my company, I've to set proxy configuration file manually, I'm wondering if there any OSX's command can help me to set proxy configuration file? So that I can create an alias in my zshrc file.

1 Answer 1


networksetup is a configuration tool for network settings in System Preferences. I don't really known what the ShadowsocksX project is, but this command can help you up.

For instance, for a certain .pac config file, you could do:

networksetup -setautoproxyurl "Wi-Fi" "http://somedomain.com/proxy.pac"

PS: if you just need to set the proxy for something like wget, or curl, then you can use the fairly universal http_proxy and ftp_proxy ENV variables (e.g., export http_proxy=http://myproxy:port).

  • 5
    Thanks, it's networksetup -setautoproxyurl "Wi-Fi" "http://somedomain.com/proxy.pac"
    – alwaysday1
    Commented Jan 9, 2015 at 9:21
  • @tli2020 Thanks buddy, not sure why this comment is not the answer...
    – SRG
    Commented Feb 12, 2021 at 13:04
  • 1
    @SRG Thanks for updating the answer:)
    – alwaysday1
    Commented Feb 13, 2021 at 4:53
  • @tli2020 My pleasure, thanks to you for providing the answer!
    – SRG
    Commented Feb 14, 2021 at 17:38
  • 1
    ping github.com in terminal still doesn't get proxy-ed ... any way to fix this? Commented Dec 2, 2021 at 9:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .