Mac OS X,  Mass Deployment

Grabbing Serials and MAC Addresses

During various automations in Mac OS X it helps to grab some key unique identifiers for machines. Two very common identifiers are the serial number of a computer and the MAC Address. To grab a systems serial number I usually use ioreg to run the following, which simply outputs a systems serial number:

ioreg -l | grep IOPlatformSerialNumber | cut -c 37-46

Because a system can have multiple MAC addresses (one per unique adapter), I will also use ioreg to grab those:

ioreg -l | grep IOMACAddress

Or to just see an output of the first in the list (en0):

ioreg -l -w 0 | grep IOMACAddress | cut -c 37-48 | head -n 1