Skip to content

Instantly share code, notes, and snippets.

@brunerd
Last active January 7, 2025 05:27
Show Gist options
  • Save brunerd/0e2aae5266ad518767bf9bbc6b24ae61 to your computer and use it in GitHub Desktop.
Save brunerd/0e2aae5266ad518767bf9bbc6b24ae61 to your computer and use it in GitHub Desktop.
Shell one liners for getting Mac hardware Serial, UUID, and Board ID
#Serial Number - x86/ARM
mySerial=$(/usr/libexec/PlistBuddy -c "print :0:IOPlatformSerialNumber" /dev/stdin <<< "$(ioreg -ard1 -c IOPlatformExpertDevice)")
#UUID - x86/ARM
myUUID=$(/usr/libexec/PlistBuddy -c "print :0:IOPlatformUUID" /dev/stdin <<< "$(ioreg -ard1 -c IOPlatformExpertDevice)")
#Provisioning UDID - ARM only, Monterey+ only
myProvisioningUDID=$(/usr/libexec/PlistBuddy -c "print 0:_items:0:provisioning_UDID" /dev/stdin <<< "$(system_profiler -xml SPHardwareDataType)")
#Model ID - Universal
myModelID=$(sysctl -n hw.model)
#NOTE: Different output depending on platform!
# ARM (Device ID) - J314cAP
# Intel (Model ID)- MacBookPro14,3
myDeviceID=$(/usr/libexec/PlistBuddy -c "print :0:IORegistryEntryName" /dev/stdin <<< $(ioreg -arc IOPlatformExpertDevice -d 1))
#Board ID - Intel ONLY, Mac-551B86E5744E2388
#UNIVERSAL
myBoardID=$(/usr/libexec/PlistBuddy -c "print :0:board-id" /dev/stdin <<< $(ioreg -arc IOPlatformExpertDevice -d 1))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment