本文转载至:http://osxdaily.com/2011/07/15/get-cpu-info-via-command-line-in-mac-os-x/
转载说明:由于 Mac OS X不像Linux,它没有/proc系统,在网上找到下面一篇文章关于如何在Mac OS X上获取 CPU info。
Ever wondered specifically what processor was being used on a Mac, including processor type and CPU speed? It’s actually quite easy to retrieve CPU information from the command line in Mac OS X, though the commands to use may be unfamiliar to many. We’ll show two ways to grab a Macs CPU details from the command line of OS X.
Finding Mac Processor Details & CPU Speed with sysctl
First we’ll use sysctl because it give us everything on one easy to read line:
sysctl -n machdep.cpu.brand_string
The example output may look like any of the following:
% sysctl -n machdep.cpu.brand_string
Intel(R) Core(TM) i5-5257U CPU @ 2.70GHz
This is basically in the following format: Chip Brand – Processor Type and Chip Model – CPU Speed
Intel(R) Core(TM)2 Duo CPU E8600 @ 2.40GHz
That detailed output of sysctl is advantageous because it reports back the chip model as well.
Get CPU Processor Details of a Mac with system_profiler
On the other hand, if you don’t want the model number and simply want processor name, speed, and the number of processors, you can use grep with system_profiler:
system_profiler | grep Processor
Processor Name: Intel Core 2 Duo
Processor Speed: 2.4 GHz
Number of Processors: 1
There are probably other methods as well, but these two are detailed and give you the information you need.
For the record, and for more average Mac users, there is a much easier way to get this information, just go to “About This Mac” under the Apple menu.