Get System Information On A Mac From The Command Line
This gets you the hardware model name:
Code
sysctl hw.model | sed 's/^.*: //'
Results
MacBookPro18,4
it's weird that that works, but it doesn't show up if you do
sysctl -a | grep model
Commands:
system_profiler sw_vers uname
Code
sysctl -a
kern.ostype: Darwin kern.osrelease: 21.3.0 kern.osproductversion: 12.2.1 kern.osproductversioncompat: 10.16 hw.memsize: 68719476736 hw.activecpu: 10 hw.cpufamily: 458787763 hw.cputype: 16777228 hw.logicalcpu: 10 hw.logicalcpu_max: 10 hw.physicalcpu: 10 hw.physicalcpu_max: 10 machdep.cpu.brand_string: Apple M1 Max machdep.cpu.core_count: 10 kern.version: Darwin Kernel Version 21.3.0: Wed Jan 5 21:37:58 PST 2022; root:xnu-8019.80.24~20/RELEASE_ARM64_T6000 kern.osversion: 21D62
Things on an AWS EC2 Ubuntu 22_04 machine:
kernel.osrelease = 5.15.0-1019-aws kernel.ostype = Linux