Read Hardware Details with sysctl hw
Get CPU model, core count, RAM size, and boot-time kernel stats from the kernel's sysctl tree.
Run `sysctl -n machdep.cpu.brand_string` for the CPU model, `sysctl hw.ncpu` for cores, and `sysctl hw.memsize` for RAM bytes.
01Command
Command
$ sysctl -n machdep.cpu.brand_string && sysctl -n hw.ncpu && sysctl -n hw.memsize02What it does
sysctl exposes kernel state as a tree of named values: `hw.*` for hardware inventory, `machdep.*` for CPU details, and `kern.*` for boot arguments and limits. `-n` prints just the value, which makes it perfect for scripts — e.g. `sysctl -n hw.ncpu` to size a build's parallelism. Apple Silicon Macs also expose `hw.perflevel*` core split between performance and efficiency cores.
03Risk
04Undo
✓No undo needed — this command does not change persistent state.
05Sources
- SYSCTL Command: Get or set the kernel state in macOSEvidence: Documents sysctl -a listing, -n value-only output, and the hw/machdep kern trees.
Last verified: 2026-09-17 · Category: System & Settings