Some scripts I use to make my life easier.
Script to toggle / change proxy settings in macOS from the command line.
- Enable / Disable proxy.
- Change proxy settings by entering manually.
- Set proxy directly using presets.
Each line should be of the following type.
<Preset_name>="<server> <port> <username> <password> "
Note: Leave the username, password fields empty if not required.
- Add/Edit presets in the
proxy.presets
file. - Move the
proxy.presets
file to$HOME
folder. - Change the
play_with_proxy.sh
file extension to.command
(For macOS) - Enable execution by running this command.
chmod a+x play_with_proxy.command
- Double click on
.command
file to execute.
- Add/Edit presets in the
proxy.presets
file. - Move the
proxy.presets
file to$HOME
folder. - Change the
networksetup
commands.
For many linux distros you change the commands to
export http_proxy="http://user:password@proxy_server:port"
export https_proxy="https://user:password@proxy_server:port"
To enable / disable proxy, these environemt variables can be set / unset respectively.
- Enable execution by running this command.
chmod a+x play_with_proxy.sh
- Execute the
play_with_proxy.sh
file.
Go through the script to know how to customize it for your needs.
Checked on macos High Sierra.
Any imrovements are welcome.
Note: Works on all systems with bash. Change the networksetup
commands accordingly for your OS.
More scripts on the way.