Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Auto-disable AirPort when ethernet is active' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Auto-disable AirPort when ethernet is active
Authored by: devguydavid on Aug 30, '14 10:26:14AM
The assumption made is that en0 is the wired interface and en1 is the wireless. That's not always the case anymore. This is how to detect which is which.

Note that you need to change the Display Ethernet below to whatever title your own wired network adapter shows. Run networksetup -listnetworkserviceorder and look through the list to find what your value is. (Display Ethernet is what is shown for my Thunderbolt Display ethernet port.)

eth_dev=`networksetup -listnetworkserviceorder | sed -En 's/^\(Hardware Port: Display Ethernet, Device: (en.)\)$/\1/p'`
wifi_dev=`networksetup -listnetworkserviceorder | sed -En 's/^\(Hardware Port: (Wi-Fi|AirPort), Device: (en.)\)$/\2/p'`

Then, in the script, replace en0 with $eth_dev and en1 with $wifi_dev.

[ Reply to This | # ]