Read Hardware Details with sysctl hw

Get CPU model, core count, RAM size, and boot-time kernel stats from the kernel's sysctl tree.

macOShardwaresysctlcpuLow risk
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.memsize

02What 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

RiskLow risk

04Undo

✓No undo needed — this command does not change persistent state.

05Sources

Last verified: 2026-09-17 · Category: System & Settings

06Related solutions