Set HTTP, HTTPS, FTP, SOCKS, Streaming, Gopher to 10.11.0.1 and port 8080,
with no username and password. And it works for Safari and App Store. And set the same entries to Firefox and it also works with no issue.
How do I set the proxy for particular networks so that it works fine on every app?
Best Answer
You have configured several proxies in System Preferences, and that's the right way to do it (that's why the App Store app and Safari work fine). Unfortunately, Terminal is an exception and needs its own proxy settings.
Why is that? Terminal is merely a container that runs a shell. A shell a program that, simply put, displays a prompt and waits patiently for you to execute commands like
ls
andrm
.Shells predate macOS and have their own rules for configuring proxies. Shells know nothing about proxy settings in System Preferences, and they need to be configured separately.
macOS's default shell is Bash (you can find out which shell you are running by executing
echo $0
at the prompt) so I'll explain how to set the proxy in Bash.The simple solution
Launch Terminal and type this command to change directory to our home directory:
Type these commands to open
.bash_profile
with TextEdit:Set the proxy environment variables by typing the following text in TextEdit and replace
<your http proxy>
,<your https proxy>
and<your ftp proxy>
with your proxy server (if TextEdit already contains text, add the text below at the end of the file):If you have configured in System Preferences a list of hosts and domains that should be contacted directly bypassing the proxy, add them like this:
For example:
Save the file with ⌘S and close TextEdit.
A more elaborate solution
The method above has a drawback: you need to keep two configurations, the one in System Preferences and the one in
.bash_profile
.Luckily, as explained on Derek Morgan's blog, you can have Bash import the System Preferences proxy settings using the
scutil
command. Simply follow the steps detailed in the previous section, but in step 3 set the http/https/ftp proxy environment variables as follows:In the definitions above, I set
http://
as the scheme for all proxy servers, you might need to modify them tosocks5://
for SOCKS orhttps://
for HTTPS as necessary.