Home » Questions » Computers [ Ask a new question ]

How to find out Mac OS X version from Terminal?

How to find out Mac OS X version from Terminal?

I know how to find Mac OS X version from GUI: Apple Menu (top left) > About This Mac

Asked by: Guest | Views: 371
Total answers/comments: 2
bert [Entry]

"You have a few options:

sw_vers -productVersion

system_profiler SPSoftwareDataType

Either will do what you need, and will have an output format that's parseable (if that's what you're after)."
bert [Entry]

"If all you care about is the major version (10.10, 10.9), you can do

MAJOR_MAC_VERSION=$(sw_vers -productVersion | awk -F '.' '{print $1 ""."" $2}')

I use this in a couple of scripts that have to do different things if run on 10.8.x, 10.9.x and now 10.10."