Get Number of CPU in OS X (or FreeBSD)

Last modified: 
Tuesday, April 28th, 2015

Get the number of CPUs in Mac OS X

This will be double your physical CPU if hyperthreading is enabled (it probably is).

$ sysctl -n hw.ncpu
8

Get the number of physical CPUs

$ sysctl -n hw.physicalcpu
4

Get the number of logical CPUs

$ sysctl -n hw.logicalcpu
8


The operator of this site makes no claims, promises, or guarantees of the accuracy, completeness, originality, uniqueness, or even general adequacy of the contents herein and expressly disclaims liability for errors and omissions in the contents of this website.