Active connection Ethernet or Wi-Fi?

Hi all,
How to detect if the active connection is based on Ethernet or Wi-Fi (with or without MBS)?

networksetup -listallhardwareports | grep -C1 $(route get default | grep interface | awk '{print $2}')

from macos - OSX Terminal: How to figure out network connection is WIFI or LAN? - Super User

If you’re going to use this and parse it into your application, make sure you do error checking as Apple do change the format or results from command line tools whenever they please.

Using API either via declares or plugins “generally” results in less maintenance in the long run.

Thanks Sam

1 Like

I’m curious why you need this information.

Probably to report it into a window.