Mac OS X has a great feature for people who move from one location to another with different network settings. You can setup and configure different options for each of these locations. One of those options are the proxy settings for HTTP, HTTPS and FTP transfers. This is great for people who use the standard Cocoa applications because their settings are updated whenever you move. If you use the Terminal a lot, you are not so fortunate. The standard way of configuring proxy settings for command line tools is through the http_proxy environment variable. As this is not updated by the system, whenever you start a new shell you are forced to update these settings manually.
This tool queries the MacOSX Location Preferences and outputs the proxy setting in a suitable for setting it in the terminal. This is designed to be included as part of your .bashrc script so that when a new terminal is started the correct proxy settings are stored for command line tools (such as wget, curl, and fink).
pc-g64-mac2:~/proxy-config massad$ ./proxy-config
Usage: proxy-config [-f] [-h] [-s]
-f: FTP Proxy Settings
-h: HTTP Proxy Settings
-s: HTTPS Proxy Settings
pc-g64-mac2:~/proxy-config massad$ ./proxy-config -h
http://www-cache.it.usyd.edu.au:8000/
pc-g64-mac2:~/proxy-config massad$ ./proxy-config -s
http://www-cache.it.usyd.edu.au:8080/
pc-g64-mac2:~/proxy-config massad$
Download and install either the binary or source code version of the tool. If you download the source version, compile the tool. Copy the tool to a directory that is in your PATH (e.g. /usr/local/bin). Once installed add the following lines to your .bashrc file:
export http_proxy=`proxy-config -h` export https_proxy=`proxy-config -s` export ftp_proxy=`proxy-config -f`
- Source Code: Initial release, Version 0.1.
- Universal Binary Compiled version