53

Linux has a command to retrieve detailed CPU information using cat /proc/cpuinfo. Using this command, users can get CPU and CPU's core information like below.

processor   : 0
vendor_id   : GenuineIntel
cpu family  : 6
model       : 142
model name  : Intel(R) Core(TM) i5-7267U CPU @ 3.10GHz
stepping    : 9
cpu MHz     : 3096.000
cache size  : 4096 KB
physical id : 0
siblings    : 2
core id     : 0
cpu cores   : 2
apicid      : 0
initial apicid  : 0
fpu     : yes
fpu_exception   : yes
cpuid level : 22
wp      : yes
flags       : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx rdtscp lm constant_tsc rep_good xtopology nonstop_tsc unfair_spinlock eagerfpu pni pclmulqdq ssse3 cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx rdrand hypervisor lahf_lm abm 3dnowprefetch invpcid_single pti retpoline fsgsbase avx2 invpcid rdseed flush_l1d
bogomips    : 6192.00
clflush size    : 64
cache_alignment : 64
address sizes   : 39 bits physical, 48 bits virtual
power management:

processor   : 1
vendor_id   : GenuineIntel
cpu family  : 6
model       : 142
model name  : Intel(R) Core(TM) i5-7267U CPU @ 3.10GHz
stepping    : 9
cpu MHz     : 3096.000
cache size  : 4096 KB
physical id : 0
siblings    : 2
core id     : 1
cpu cores   : 2
apicid      : 1
initial apicid  : 1
fpu     : yes
fpu_exception   : yes
cpuid level : 22
wp      : yes
flags       : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx rdtscp lm constant_tsc rep_good xtopology nonstop_tsc unfair_spinlock eagerfpu pni pclmulqdq ssse3 cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx rdrand hypervisor lahf_lm abm 3dnowprefetch invpcid_single pti retpoline fsgsbase avx2 invpcid rdseed flush_l1d
bogomips    : 6192.00
clflush size    : 64
cache_alignment : 64
address sizes   : 39 bits physical, 48 bits virtual
power management:

Does macOS/OS X have a command to retrieve detailed CPU and CPU cores information equal to Linux /proc/cpuinfo? I really want to know a CLI command to retrieve the Mac's CPU core ID.

I tried sysctl machdep.cpu, but it didn't retrieve CPU core ID.

1

2 Answers 2

72

The Terminal command sysctl might be what you're looking for, in particular sysctl -a | grep machdep.cpu:

[my_mac:~] admin% sysctl -a | grep machdep.cpu
machdep.cpu.max_basic: 22
machdep.cpu.max_ext: 2147483656
machdep.cpu.vendor: GenuineIntel
machdep.cpu.brand_string: Intel(R) Core(TM) i5-8210Y CPU @ 1.60GHz
machdep.cpu.family: 6
machdep.cpu.model: 142
machdep.cpu.extmodel: 8
machdep.cpu.extfamily: 0
.
.
.

machdep.cpu.core_count: 2
machdep.cpu.thread_count: 4
machdep.cpu.tsc_ccc.numerator: 134
machdep.cpu.tsc_ccc.denominator: 2

Info gleaned from OSXDaily.

5
  • 8
    I think most people might be just looking for the number of cores. The lines you are looking for are machdep.cpu.core_count and machdep.cpu.thread_count. Note that the thread count might be greater than the core count. Look up "hyperthreading" for Intel CPUs and "simultaneous multithreading" for AMD.
    – John Red
    Sep 11, 2019 at 6:38
  • 6
    You can also use sysctl -a machdep.cpu instead of piping it to grep. (I do see this piped to grep often. Maybe this only works on new versions of macOS?) Oct 8, 2021 at 5:30
  • It seems that VirtualBox really uses machdep.cpu.thread_count to show the maximum amount of Processors (the CPUs value ) to define a new/edit VirtualMachine. It when macOS is the Host and other OS is the guest Sep 20, 2023 at 0:13
  • $ sysctl machdep.cpu.brand_string
    – xgqfrms
    Oct 19, 2023 at 2:22
  • sysctl usage: sysctl [-bdehiNnoqx] name[=value] ... sysctl [-bdehNnoqx] -a
    – xgqfrms
    Oct 19, 2023 at 2:22
8

If you go to the Apple menu item and under that is the option "About This Mac". Select that and when the pane shown below appears notice the buttons on the bottom.

enter image description here

The pane itself gives you some info but click on the System Report button. This opens a large pane where you can select specfic items to get info about. Click on an item in the left part of the pane and it tells you info about that item.

enter image description here

2
  • 6
    The CLI/Terminal equivalent is: system_profiler SPHardwareDataType
    – iapitus
    Jul 14, 2021 at 6:49
  • This is not a good idea. 1. did not use command line; 2. can not get details of the CPU version, such as i7-8700B instead of i7.
    – xgqfrms
    Oct 19, 2023 at 2:27

Not the answer you're looking for? Browse other questions tagged .