Troubleshoot macOS Proxy Settings and Network Access

Environment

Product
Product Version 1.6.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.

  1. Create a Shell file through your preferred IDE. For demonstration purposes, name ours test.sh

  2. 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 "Can't find current service"
        exit 1
    fi
    
  3. Execute the test.sh through the terminal

    sh <path-to-script>/test.sh
    
  4. On success, as an output, you will see the name of the active network adapter (for demonstration purposes, let's 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 you can successfully get the active network adapter's name, you can use it to access the OS network settings. Use the commands below to achieve the above - note that for demonstration purposes, assume 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 will return the Fiddler proxy (by default this is 127.0.0.1:8866).

An example output for the networksetup -getwebproxy command when no proxy is set

Enabled: No
Server: 
Port: 0
Authenticated Proxy Enabled: 0

An example output for the networksetup -getwebproxy command when the Fiddler Everywhere proxy is successfully set

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.

In this article