Linuxだと/proc/cpuinfoを開くことで、周波数やコア数、キャッシュ容量などの各種プロセッサ情報が取得できることはご存知でしょうか。
cat /proc/cpuinfo
一方で、MacはもちろんLinuxベースではないので、/proc/cpuinfoが存在せず、この方法では取得することができません。
代わりに下記コマンドを使うと取得できました。
system_profiler SPHardwareDataType
CPU情報以外にも様々な情報が取得でき、下記のコマンドでその種類(DataType)を確認できます。
system_profiler -listDataTypes
なお、DataTypeは複数指定することもできます。
DataTypeを指定せずに実行すると、まとめて全部表示することができますが、そこそこ重たいみたいなので注意が必要です。