3

I tested setting up a proxy.pac file via a web server:

networksetup -setautoproxyurl "Wi-Fi" "http://localhost/proxy.pac"

and via a file directly:

networksetup -setautoproxyurl "Wi-Fi" "file:///Users/username/Library/proxy.pac"

The web server method works (provided I arrange that the proxy.pac is served by a webserver). The file server doesn't work.

What's the problem, fundamentally?

Motivation for the question is, I'd like to simplify and prefer to not have to run an http server.

Peter
  • 31
  • 3

2 Answers2

0

I stumbled over the same issue. It seems like the file:/// url is not supported for proxy.pac files. Sadly I have not found any source to confirm this. The workaround I have used is to place your proxy.pac file in a dedicated folder and use the SimpleHTTPServer python module to serve the proxy.pac file.

On a shell (or a shell script) run:

mkdir proxy-pac-server
cp proxy.pac proxy-pac-server/
cd proxy-pac-server
python -m SimpleHTTPServer 8000

Then you just have to enter http://localhost:8000/proxy.pac in your macos settings or respectively on the shell:

networksetup -setautoproxyurl "Wi-Fi" "http://localhost:8000/proxy.pac"

I know this is probably not a simplification to just run a web server in your network but it may help others without a web server to use a proxy.pac file on macos.

Tervor
  • 21
  • 2
0

It sounds like you didn't (force) reload it. Run the following commands:

networksetup -setautoproxystate Wi-Fi off

networksetup -setautoproxystate Wi-Fi on

Let me know how it works out for you.

Carlos
  • 136
  • 3