sw_vers Command - Get macOS Version Information

Use the sw_vers command to easily retrieve macOS product version and build version information. A simple command-line tool for developers.

sw_vers Command

The sw_vers command is a powerful utility for macOS users and developers to quickly retrieve detailed software versioning information about the operating system. It provides essential details such as the product version and the build version, which are crucial for system identification, compatibility checks, and debugging purposes.

macOS Version Information

This section demonstrates how to use the sw_vers command to obtain the primary product version of your macOS installation.

# sw_vers
# Print Mac OSX Software versioning information.

# Print OSX Version
sw_vers -productVersion

macOS Build Version

Understanding the build version is also important for pinpointing specific software releases and patches. The following command shows how to retrieve this information.

# Print OSX Build
sw_vers -buildVersion

Why Use sw_vers?

The sw_vers command is an indispensable tool for system administrators, developers, and IT professionals who need to programmatically access macOS version details. It's often used in shell scripts for automation, environment checks, and reporting.