MacOS
Get Serial Number
system_profiler SPHardwareDataType | grep Serial
Get Hostname
scutil --get HostName
Set Hostname
sudo scutil --set HostName <new host name>
system_profiler SPHardwareDataType | grep Serial
scutil --get HostName
sudo scutil --set HostName <new host name>