Shell command for getting mac address in OS X

mac-address, macos, shell

Solution

I think the best and easiest way to get the information is using this command:

networksetup -listallhardwareports

It will return a nice list of devices like this:

Hardware Port: USB 10/100/1000 LAN
Device: en6
Ethernet Address: 00:e0:4c:...

Hardware Port: Wi-Fi
Device: en0
Ethernet Address: 80:e6:50:...

Hardware Port: Bluetooth PAN
Device: en3
Ethernet Address: 80:e6:50:...

Hardware Port: Thunderbolt 1
Device: en1
Ethernet Address: 72:00:05:...

Hardware Port: Thunderbolt 2
Device: en2
Ethernet Address: 72:00:05:...

Hardware Port: Thunderbolt Bridge
Device: bridge0
Ethernet Address: 72:00:05:...

VLAN Configurations
===================

Problem

I have been handicapped by the GUI and always seem to ask of help when it comes to the command line. On Mac OS X only I need a command line to get the mac address of the wifi currently in use. Help!

Original source