Find a MAC Address in Mac OS X
A MAC address is a unique identifier that is assigned to each physical network interface on a computer. Different than a computers IP address, MAC addresses are frequently used for network access control and to monitor network connectivity, and they can be spoofed for virtualization needs or to circumvent some network limitations. If you need to access yours, here’s how to find one from the friendly GUI and the command line.
How to Locate a MAC Address in Mac OS X
To quickly find a MAC address on a Mac with OS X, do the following:
- Open System Preferences from the Apple menu
- Click on “Network”
- Select your currently active network connection from the left menu (Wi-Fi, Ethernet, etc) and then click on “Advanced” in the lower right corner
- Look at the bottom of the window for “Wi-Fi Address”, the hexadecimal characters next to this are the machines MAC address
The address is always in the form aa:bb:cc:dd:ee:ff, looking something like “ce:9e:8d:02:1d:e9” or a variation of.
Note that the wireless MAC address will be labeled as “Wi-Fi Address” in new versions of OS X like Yosemite, Mavericks, Mountain Lion, anything from Lion and later as well as iPhone and iOS, whereas it’s called “Airport Address” in Mac OS X 10.6 Snow Leopard and before.
List All Network Hardware MAC Addresses in Mac OS X
To quickly list all MAC addresses of network hardware on a Mac, even if they are currently inactive, launch the Terminal and type the following command:
networksetup -listallhardwareports
This may return something like this, look for the string following “Ethernet Address” to find the MAC address per interface:
Hardware Port: Bluetooth DUN
Device: Bluetooth-Modem
Ethernet Address: db:26:cd:41:c3:79
Hardware Port: Ethernet
Device: en0
Ethernet Address: 21:d3:91:bb:11:bd
Hardware Port: FireWire
Device: fw0
Ethernet Address: c6:18:ed:fa:ff:15:db:51
Hardware Port: Wi-Fi
Device: en1
Ethernet Address: f2:8b:fc:ae:bb:f5
Notice that even a wi-fi cards MAC address will be referred to as “Ethernet address” using the networksetup command. You can also retrieve individual IP addresses and MAC addresses together with the ifconfig command, although the output isn’t nearly as user friendly.
If your intention is to spoof an address, generating a random MAC address is usually the best bet to avoid any network conflicts.
How to iOS installed
#!/bin/bash
#why not script it? ;-)
macfrom=”aa:aa:aa:aa:aa:aa”
macto=”bb:bb:bb:bb:bb:bb”
device=$(networksetup -listallhardwareports | grep -B 1 $macfrom | grep Device | sed ‘s/Device:\s//’)
if [ ! -z $device ]; then
echo “Candidate port found $device, switching MAC address from $macfrom to $macto”
sudo ifconfig $device ether $macto
echo “Setting port $device down”
sudo ifconfig $device down
echo “Setting port $device up”
sudo ifconfig $device up
echo “detecting new hardware”
sudo networksetup -detectnewhardware
else
echo “Candidate MAC FROM address not found!”
fi
Pls show me my Mac address
I ran the command on en1, asked for pass, however even after checking both network preferences and the grep ether, still getting old mac address.
osx mavericks
[…] Via | OSXDaily […]
Any idea how to spoof the wifi MAC addr in OS X Lion on a MacBook Air without ethernet? Couldn’t get the previous instructions to work.
Great tips, keep em coming!
[…] MAC address should stay spoofed until reboot, but you can always check what your MAC address is in the GUI or command line with networksetup -listallhardwareports if you’re curious about the current status. […]
In addition, “ifconfig -a | grep ether” will also show you virtual hardware addresses if you have vmware or virtual box installed.