Troubleshoot macOS Proxy Settings Access
Environment
Product | Fiddler Everywhere |
Product Version | 1.0.0 and above |
--- | --- |
Operating System | macOS |
Description
In some corner cases, the Fiddler Everywhere client might not access the macOS network settings (for example, due to administrative restrictions, firewall settings, etc.). The technique demonstrated in this article will allow you to manually test the access to the active network adapter and its proxy settings on macOS.
Accessing the Active Network Adapter Name
The Fiddler Everywhere client will use the name of the active network adapter (for example, something like Wi-FI) to set the Fiddler proxy. You can get the name manually by creating and executing a Shell script.
Create a Shell file via your preferred IDE. For demonstration purposes, we will name ours test.sh
-
In the newly created test.sh copy and paste the following Shell script.
services=$(networksetup -listnetworkserviceorder | sed '1d;s/^([^)]*) \(.*\)$/\1FIDDLER_SEPARATOR/g;s/^.*Device: \([^)]*\))/\1/g;/^$/d' | sed 'N;s/\n//') while read line; do sname=$(echo $line | awk -F "FIDDLER_SEPARATOR" '{print $1}') sdev=$(echo $line | awk -F "FIDDLER_SEPARATOR" '{print $2}') if [ -n "$sdev" ]; then ifconfig $sdev 2>/dev/null | grep 'status: active' > /dev/null 2>&1 rc="$?" if [ "$rc" -eq 0 ]; then currentservice="$sname" echo "\"$currentservice\"" break fi fi done <<< "$(echo "$services")" if ! [ -n "$currentservice" ]; then >&2 echo "Could not find current service" exit 1 fi
-
Execute the test.sh via the terminal
sh <path-to-script>/shell.sh
On success, as an output, you should see the name of the active network adapter (for demonstration purposes, we will assume the result is Wi-Fi). Not being able to get the active network adapter name successfully indicates system restrictions or wrongful network configuration.
An example output from executing test.sh
"Wi-Fi"
Refer to the next section on how to use this name for further troubleshooting.
Troubleshooting the Proxy Settings
Once we can successfully get the active network adapter's name, we can use it to access the OS network settings. Use the commands below to achieve the above - note that for demonstration purposes, we are assuming that the adapter name is Wi-Fi.
networksetup -getproxyautodiscovery "Wi-Fi"
networksetup -getautoproxyurl "Wi-Fi"
networksetup -getproxybypassdomains "Wi-Fi"
networksetup -getwebproxy "Wi-Fi"
networksetup -getsecurewebproxy "Wi-Fi"
networksetup -getftpproxy "Wi-Fi"
networksetup -getsocksfirewallproxy "Wi-Fi"
The output from the above commands will vary depending on the OS network settings that are in place. You can use the output to troubleshoot your OS network settings with and without Fiddler Everywhere capturing mode. For example, when FIddler Everywhere is properly set to capture traffic and capturing mode is ON, the getsecurewebproxy option should returng the Fiddler proxy (by default this is 127.0.0.1:8866).
An example output for the networksetup -getwebproxy
Enabled: No
Server:
Port: 0
Authenticated Proxy Enabled: 0
An example output for the networksetup -getwebproxy
Enabled: Yes
Server: 127.0.0.1
Port: 8866
Authenticated Proxy Enabled: 0
On some occasions, there might be more than one active network adapters. Use the command
networksetup -listnetworkserviceorder
to get the names of all active adapters and then use the adapter's name to troubleshoot the Fiddler Everywhere proxy settings.