ifconfig

How to find the wifi physical address of mac book from the ifconfig output.

iOS 11.2.2

Posted on Sep 19, 2018 3:19 AM

Reply
Question marked as Top-ranking reply

Posted on Sep 20, 2018 10:53 PM

ifconfig is not the best command to do this. The ifconfig results do not make it clear which interface is the WiFi interface. As it happens on all MacBooks it will almost certainly be called en0 but on other models en0 might be an Ethernet interface.


Other command line tools can be used to find the same information but make it clearer which interface is a WiFi and which is Ethernet. The following shell script command will use the Apple networksetup tool to find your WiFi interface, list its details, pipe to grep to find the specific line containing the WiFi interface MAC address i.e. Physical address and then pipe that to awk to extract just the MAC address.


networksetup -getinfo Wi-Fi | grep Wi-Fi | awk '{print $3}'

2 replies
Question marked as Top-ranking reply

Sep 20, 2018 10:53 PM in response to rajeshwarikrk

ifconfig is not the best command to do this. The ifconfig results do not make it clear which interface is the WiFi interface. As it happens on all MacBooks it will almost certainly be called en0 but on other models en0 might be an Ethernet interface.


Other command line tools can be used to find the same information but make it clearer which interface is a WiFi and which is Ethernet. The following shell script command will use the Apple networksetup tool to find your WiFi interface, list its details, pipe to grep to find the specific line containing the WiFi interface MAC address i.e. Physical address and then pipe that to awk to extract just the MAC address.


networksetup -getinfo Wi-Fi | grep Wi-Fi | awk '{print $3}'

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

ifconfig

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.