Tiny Deathstars of Foulness

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

May 12th, 2010

Posted In: Mac OS X, Mass Deployment

Tags: , , , ,

  • Beware of the new 17 inch MacBook Pros, they have an extra character in the serial.

  • Pingback: One More Character In Serials | Krypted()

  • nate

    why not use something like this instead?

    system_profiler SPHardwareDataType | awk ‘/Serial/ {print $4}’

    or if you have puppet installed, you can use facter to grab all of those details.