Get a Mac’s Serial Number from the Command Line


To totally unlock this section you need to Log-in


Login

You can quickly retrieve any Mac's serial number via the command line by using the following command string:

system_profiler |grep "r (system)"

The command results will look something like this:

$ system_profiler | grep "r (system)"

Serial Number (system): C24E1322XXXX

If you just grep for “Serial Number” you’ll be presented with serial numbers to other hardware included in the Mac, which is why the “r (system)” qualifier is included.

The following commands are alternatives to the above command:

system_profiler SPHardwareDataType | grep “Serial”

Or:
system_profiler | less
Or:
system_profiler SPHardwareDataType | awk ‘/Serial Number/ { print $4; }’

1 thought on “Get a Mac’s Serial Number from the Command Line”

Comments are closed.