Apple Event: May 7th at 7 am PT

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Setting proxy servers via the command line

I am looking to find out how to set up the system to use http and https proxies via the command line instead of through system preferences. How do I do this. I have basic command line knowledge.

G4 (AGP Graphics), Mac OS X (10.4.9)

Posted on Dec 29, 2007 4:35 PM

Reply
2 replies

Dec 30, 2007 12:09 AM in response to Sawtooth501

This information is stored in a plist file and is easiest to manipulate with PlistBuddy. For example, to set the HTTP proxy name, use:

/usr/libexec/PlistBuddy -c "Set NetworkServices:6CFBA910-E4A0-4418-82E5-66A6480EBC71:Proxies:HTTPProxy http://my.proxy.com" /Library/Preferences/SystemConfiguration/preferences.plist

Note: 6CFBA910-E4A0-4418-82E5-66A6480EBC71 is a UUID and likely to be unique on each machine. I don't have another Mac handy to check this. If so, you'll need to do some heavy to find out which one is the interface you need to address.

Try man PlistBuddy and/or a web search for more information on how this tool can be used.


Try man PlistBuddy or a web searc for more info on using it.

Dec 30, 2007 7:15 AM in response to Sawtooth501

use networksetup, which used to be part of the ARD client package but is now in /usr/sbin/networksetup under 10.5.x.

the old path (10.3, 10.4) is: /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Support/net worksetup

to set proxy servers, use it like so (from the examples):

networksetup -setsecurewebproxy <networkservice> <domain> <port number> <authenticated> <username> <password>

"networkservice" is the name of the interface as shown in network prefs, so "AirPort" or "Built-in Ethernet" and the like.

Setting proxy servers via the command line

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.