I’d like to programmatically get the CPU descriptions on Mac OS X, which look something like this:
Intel(R) Core(TM)2 CPU 6700 @ 2.66GHz
Intel(R) Xeon(R) CPU X5550 @ 2.67GHz
On Linux you can do grep "^model name" /proc/cpuinfo and on Windows you can look at the ProcessorNameString value in HKLM\Hardware\Description\System\CentralProcessor\0 in the registry, but how do you get that information on OS X?
You can pass
machdep.cpu.brand_stringto sysctl to retrieve the string you’re looking for.The same information is exposed through the
sysctl(3)functions.