Get Exact macOS Version and Build Number
sw_vers and sysctl reveal the precise OS build and kernel architecture in one line.
Run `sw_vers` for the product version and build, and `uname -m` for the CPU architecture (arm64 vs x86_64).
01Command
Command
$ sw_vers -productVersion && sw_vers -buildVersion && uname -m02What it does
'About This Mac' shows a marketing version like 15.2, but support staff and compatibility tables need the build number, which sw_vers -buildVersion provides. Kernel-level details like `sysctl -n kern.osproductversion` and `sysctl -n machdep.cpu.brand_string` cover cases where sw_vers isn't available. Together these are the fastest way to script OS checks in a setup script.
03Risk
04Undo
✓No undo needed — this command does not change persistent state.
05Sources
- macOS sw_vers — display the macOS version and buildEvidence: Documents sw_vers -productVersion, -buildVersion and -osVersion flags.
Last verified: 2026-09-17 · Category: System & Settings