Forrest logo
back to the system_profiler tool

system_profiler:tldr:a2de5

system_profiler: Print the system serial number.
$ system_profiler SPHardwareDataType|grep "Serial Number (system)" | awk '{ print $4 }'
try on your machine

This command retrieves the serial number of a Mac system using a combination of three utilities: system_profiler, grep, and awk.

  • system_profiler is a Mac utility that provides detailed information about hardware and software configurations.
  • SPHardwareDataType is an argument passed to system_profiler to specifically retrieve hardware-related information.
  • grep "Serial Number (system)" filters the output from system_profiler to only show the line that contains the serial number of the system. The "Serial Number (system)" is the search pattern used by grep.
  • awk '{ print $4 }' selects the fourth field (word) from the filtered output and prints it. This essentially retrieves the serial number of the Mac system.

So, when you run this command in the Terminal on a Mac, it will output the serial number of the system.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the system_profiler tool