4yz8dq
Last Updated: February 25, 2016
·
29.31K
· kevinelliott
F36a3d6a839ba2562c08af5793e68748

Determine OS X version from the command line

There are a few ways to determine what version of OSX you are on.

In the GUI, you can easily click the Apple menu () at the top left of your screen, and choose About This Mac. The version of OS X will be printed underneath the large bold Mac OS X title. Clicking on the Version XYZ text will reveal the Build number.

If you're writing a script though, you may wish to access this programmatically. There are several ways:

System Profiler

1.9.2 kevin-macbookpro:~ $ system_profiler SPSoftwareDataType
Software:

System Software Overview:

  System Version: Mac OS X 10.7.4 (11E53)
  Kernel Version: Darwin 11.4.0
  Boot Volume: San Francisco
  Boot Mode: Normal
  Computer Name: Kevin Elliott’s MacBook Pro
  User Name: Kevin Elliott (kevin)
  Secure Virtual Memory: Enabled
  64-bit Kernel and Extensions: Yes
  Time since boot: 1 day12:47

sw_vers

1.9.2 kevin-macbookpro:~ $ sw_vers
ProductName:    Mac OS X
ProductVersion: 10.7.4
BuildVersion:   11E53

Mac OS X user defaults system

1.9.2 kevin-macbookpro:~ $ defaults read loginwindow SystemVersionStampAsString
10.7.4

There are further options but they are not as optimized and simple to use. These should be sufficient!

Say Thanks
Respond

1 Response
Add your response

6574
335c2aadfc91c6061123ebe4a12d4c6c

Thank you!

over 1 year ago ·
Filed Under