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

Get the number of physical CPUs

$ sysctl -n hw.physicalcpu

Get the number of logical CPUs

$ sysctl -n hw.logicalcpu

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.