25 May
2019
25 May
'19
2:48 a.m.
On May 24, 2019, at 22:31, Richard L. Hamilton <rlhamil2 at gmail.com> wrote:
Hmm. MacPorts has it (I think homebrew might too, not sure about fink). This worked for me: dmidecode -t system 2>/dev/null | awk '/Serial Number:/ {print $NF}'
The 2>/dev/null was because it kept spitting out a "Bad address" message, although it otherwise worked fine.
This works better in case there are spaces in the serial number (there were in my Linux VM's under Parallels on my Macs), and still works on MacOS itself: dmidecode -t 1 2>/dev/null | sed -n -e 's/.*Serial Number: *//p'