Using a bash script to set up Proxies on macOS
Mojave 10.14.6
My company use Proxy. One Proxy for HTTP and One Proxy for HTTPS and some Bypass proxy settings for these Hosts & Domains.
I was not able to reach google.com website because I had to specify the proxy which I did and everything is working as expected.
But I want to automate my process instead of using the GUI.
I have a strange behavior with my script below when I try to set up: System Preferences > Network > "Example Wi-Fi" > Advanced > Proxies.
Again, if I set all the Proxies parameters using the GUI (manually) everything is working as expected but I if try to use my script below I am having issues like I cannot reach web sites, etc.
I am pretty sure I am missing some command lines from my script. The funny things that when I run the script I can literally see all the parameters being applied to the GUI (Network > Proxies), as if I had to manually inserted. Again they are all there. I tried to reboot my Mac Laptop, I also try to reset some DNS cache but nothing, still same strange issue.
What could be the issue? What command line from the script I am missing?
See my script below (for security reasons I am faking the IP address and domain name.)
Thank you in advance.
#!/bin/bash
networksetup -setwebproxy "Wi-Fi" 10.10.10.10 8080
networksetup -setsecurewebproxy "Wi-Fi" 10.10.10.20 8443
networksetup -setproxybypassdomains "Wi-Fi" "127.0.0.1,*.local,169.254/16,*.subdomain.maindomain.com,*.maindomain.com"
networksetup -setwebproxystate "Wi-Fi" on