Terminal

How to Check macOS Version in Terminal (sw_vers and More)

Published Nov 6, 2026
Tested on a real Mac. Ran sw_vers (all flags), uname, arch, sysctl, system_profiler SPSoftwareDataType (plain and -json), plutil/defaults read on SystemVersion.plist, osascript, python3 platform.mac_ver, SYSTEM_VERSION_COMPAT, arch -x86_64 under Rosetta and three version-comparison tests on an M3 Mac (macOS 26.6.2, zsh 5.9); the About This Mac window was not used, and nothing was changed on the system. Test machine: MacBook Air (M3, 16 GB), macOS Tahoe 26.6.2, zsh 5.9.
On this page
  1. sw_vers: the fastest answer
  2. uname shows the Darwin kernel, not macOS
  3. Full details with system_profiler
  4. Other ways that give the same number
  5. Is my Mac arm64 or x86? (and the Rosetta trap)
  6. Comparing versions in a script (don’t use string compare)
  7. Common questions

To check your macOS version in Terminal, run:

sw_vers

It prints the product name, the version number and the build number in about 6 milliseconds. If you only want the number (for a script or a bug report), use sw_vers -productVersion.

Below is everything I tested on a MacBook Air M3 running macOS Tahoe 26.6.2: the other commands that report the version, how to tell Apple Silicon from Intel, and one version-comparison mistake that breaks a lot of shell scripts.

sw_vers: the fastest answer

sw_vers is built into every Mac at /usr/bin/sw_vers. Here is the real output from my Mac:

ProductName:		macOS
ProductVersion:		26.6.2
BuildVersion:		25G83
  • ProductVersion is the marketing version. 26.6.2 means macOS Tahoe 26, update 6.2.
  • BuildVersion (25G83) is Apple’s internal build. It is what Apple support and beta testers ask for, because two Macs can show the same version but run different builds.

Each field has its own flag, so you can grab one value without parsing:

sw_vers -productVersion
sw_vers -buildVersion
sw_vers -productName
26.6.2
25G83
macOS

The full list of flags, from sw_vers --help:

Usage: sw_vers [--help|--productName|--productVersion|--productVersionExtra|--buildVersion]

--productVersionExtra is for Apple’s Rapid Security Responses, the small security patches that add a letter like (a). On my Mac it printed an empty line and exited with 0. Empty output there is normal and just means no such patch is installed.

uname shows the Darwin kernel, not macOS

Many answers online suggest uname -a. It works, but it does not show the macOS version:

uname -a
Darwin MacBook-Air.local 25.6.0 Darwin Kernel Version 25.6.0: Fri Jul 31 19:18:29 PDT 2026; root:xnu-12377.161.14~5/RELEASE_ARM64_T8122 arm64

25.6.0 is the version of Darwin, the Unix core under macOS. On this Mac, Darwin 25.6 goes with macOS 26.6. The numbers are close but not the same, so don’t paste uname -r into a bug report as “my macOS version”. Use uname when you need the kernel version or the CPU type, and sw_vers for everything else.

Full details with system_profiler

For a more complete summary, ask System Information for its software section:

system_profiler SPSoftwareDataType
Software:

    System Software Overview:

      System Version: macOS 26.6.2 (25G83)
      Kernel Version: Darwin 25.6.0
      Boot Volume: Macintosh HD
      Boot Mode: Normal
      Computer Name: MacBook Air
      User Name: you (you)
      Secure Virtual Memory: Enabled
      System Integrity Protection: Enabled
      Time since boot: …

This puts the macOS version, the build and the kernel on one line each. It also tells you whether System Integrity Protection is on and whether you booted in Safe Mode (Boot Mode). That makes it the best thing to paste into a support forum. Just remove your computer name and user name first, because it prints both.

One detail I noticed: the Time since boot line uses your system language. On a Mac set to another language, that line is translated even though the labels stay in English. If you parse this output, use the JSON version instead:

system_profiler SPSoftwareDataType -json

The fields you want are os_version (macOS 26.6.2 (25G83)) and kernel_version (Darwin 25.6.0).

Speed difference, measured with time: sw_vers -productVersion took 0.006 seconds and system_profiler SPSoftwareDataType took 0.147 seconds. Both are instant for a human, but in a loop or a shell prompt, sw_vers is about 25 times faster.

Other ways that give the same number

All of these printed 26.6.2 on my Mac:

sysctl -n kern.osproductversion
osascript -e 'system version of (system info)'
python3 -c 'import platform; print(platform.mac_ver()[0])'
plutil -p /System/Library/CoreServices/SystemVersion.plist

sysctl -n kern.osversion gives the build (25G83). The plist file is where the version is actually stored, and reading it with plutil -p changes nothing:

{
  "BuildID" => "900EF00A-96B9-11F1-9901-B394A77C0399"
  "iOSSupportVersion" => "26.6"
  "ProductBuildVersion" => "25G83"
  "ProductCopyright" => "1983-2026 Apple Inc."
  "ProductName" => "macOS"
  "ProductUserVisibleVersion" => "26.6.2"
  "ProductVersion" => "26.6.2"
}

Older guides mention the SYSTEM_VERSION_COMPAT=1 variable, which old scripts used to get a “10.x” style version back. I tried it with sw_vers and with Python on Tahoe, and it had no effect. Both still printed 26.6.2. Don’t rely on it.

Is my Mac arm64 or x86? (and the Rosetta trap)

To check whether you are on Apple Silicon or Intel:

uname -m
sysctl -n machdep.cpu.brand_string
arm64
Apple M3

arm64 means Apple Silicon and x86_64 means Intel. But there is a catch. When a command runs under Rosetta (for example, an Intel-only Terminal app or an old Homebrew install in /usr/local), uname -m lies. I forced that case with arch -x86_64:

arch -x86_64 uname -m
arch -x86_64 sysctl -n sysctl.proc_translated
x86_64
1

So the same M3 Mac reported x86_64. The reliable test is sysctl -n sysctl.proc_translated. It prints 0 for a native process and 1 for one running under Rosetta. If you see x86_64 together with 1, you have an Apple Silicon Mac and the shell is running translated. A translated shell can also send Homebrew to the wrong folder. See zsh: command not found: brew for that fix.

Comparing versions in a script (don’t use string compare)

This one is easy to get wrong. A plain string comparison gets the order wrong:

v=$(sw_vers -productVersion)
[[ "$v" > "9.0" ]] && echo "string says newer" || echo "string says older"
string says older

zsh compares the text character by character, and "2" sorts before "9", so it decides macOS 26.6.2 is older than 9.0. The jump from macOS 15 to 26 makes this bug more likely to show up in old scripts. Two comparisons that worked correctly:

# compare only the major version as a number
ver=$(sw_vers -productVersion | cut -d. -f1)
(( ver >= 15 )) && echo "major $ver >= 15"

# or use zsh's built-in helper for full versions
autoload is-at-least
is-at-least 15.0 "$(sw_vers -productVersion)" && echo "is-at-least: ok"
major 26 >= 15
is-at-least: ok

is-at-least ships with zsh, so nothing needs to be installed. In bash, stick with the cut plus (( )) approach.

Common questions

What is the shortest command to see my macOS version?

sw_vers -productVersion. It prints only the number, such as 26.6.2.

How do I check the macOS version without opening Terminal?

Open the Apple menu and choose About This Mac. The window shows the macOS name and version. I did not use this window for this guide. All the numbers above come from Terminal.

Why does uname say 25 when I’m on macOS 26?

uname reports the Darwin kernel version, not the macOS version. On my Mac, Darwin 25.6.0 goes with macOS 26.6.2. Use sw_vers for the macOS number.

Which command should I paste into a bug report?

sw_vers (version plus build) and uname -m (CPU type). If someone asks for more, use system_profiler SPSoftwareDataType, but delete the computer name and user name lines first. For the hardware side, check your RAM usage in Terminal covers memory.

Does checking the version change anything on my Mac?

No. Every command here only reads information. defaults read and plutil -p on SystemVersion.plist are read-only, and the file is protected by System Integrity Protection anyway.