From LedHed's Wiki
Contents
Overview
Ways to obtain the serial number off a Mac
Command Line
macOS
ioreg -l | grep IOPlatformSerialNumber
OS X
system_profiler SPHardwareDataType | grep Serial
GUI
Click the Apple logo in the upper Left and click: 'About This Mac'
Reference
https://osxdaily.com/2011/04/25/get-mac-serial-number-command-line/