EDIT: I am assuming you actually means Mac OS X, and not Mac OS..
You can use the commandline tool 'networksetup'
There is a manpage for it - networksetup(8)
man networksetup
You will find many options for proxy settings in there:
[-setftpproxy networkservice domain portnumber authenticated username password]
[-setftpproxystate networkservice on | off] [-getwebproxy networkservice]
[-setwebproxy networkservice domain portnumber authenticated username password]
[-setwebproxystate networkservice on | off] [-getsecurewebproxy networkservice]
[-setsecurewebproxy networkservice domain portnumber authenticated username password]
[-setsecurewebproxystate networkservice on | off] [-getstreamingproxy networkservice]
[-setstreamingproxy networkservice domain portnumber authenticated username password]
[-setstreamingproxystate networkservice on | off] [-getgopherproxy networkservice]
[-setgopherproxy networkservice domain portnumber authenticated username password]
[-setgopherproxystate networkservice on | off] [-getsocksfirewallproxy networkservice]
[-setsocksfirewallproxy networkservice domain portnumber authenticated username password]
[-setsocksfirewallproxystate networkservice on | off] [-getproxybypassdomains networkservice]
[-setproxybypassdomains networkservice domain1 [domain2] [...]] [-getpassiveftp networkservice]
Alternatively, 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.
Eg in bash:
export http_proxy=http://my.proxy.com:1234
Where '1234' is the port number.
cheers
sc.
1Is there a way to set the Automatic Proxy Configuration I didn't see it in the options – Jeef – 2015-09-23T23:48:36.653
@Jeef: See https://superuser.com/questions/1035461/setting-proxy-settings-to-auto-proxy-detection-using-command-line-mac-osx/1047347#1047347
– Mikey T.K. – 2016-03-01T17:15:28.857can you give example of the
-setwebproxy
option -- i want to connect without username and password and not sure what to enter for those fields – Dinesh – 2017-02-28T22:23:09.177@swisscheese is there a method of setting proxy as an option to safari? sort of like how on chrome for windows you can do
start chrome --proxy-server=calamari652.gc-va.ncbi.nlm.nih.gov:3128
– Akin Hwan – 2019-10-16T16:18:20.067thanks.
networksetup
is just what I want. – flanker – 2011-08-02T03:26:02.880