Skip to content

Instantly share code, notes, and snippets.

@bryankennedy
Last active April 6, 2023 14:38
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bryankennedy/9273374 to your computer and use it in GitHub Desktop.
Save bryankennedy/9273374 to your computer and use it in GitHub Desktop.
OS X Command line tools to get Mac hardware information
# Use the command line to get Mac hardware info, like the serial number.
# Returns a paragraph of basic hardware information
system_profiler SPHardwareDataType
# Returns a sentence on the serial number:
# Serial Number (system): <number>
system_profiler SPHardwareDataType | grep "Serial Number"
# Returns just the serial number
ioreg -c "IOPlatformExpertDevice" | awk '/IOPlatformSerialNumber/ {print $4}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment