Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

Is there a Terminal command that will tell me Mac OS X version?

share|improve this question
up vote 140 down vote accepted

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).

share|improve this answer
sw_vers is all I need. Thanks! :) – Željko Filipin Nov 25 '09 at 21:09
The first one only gives you the OS version (ie, "10.7.5"). The second one gives you a lot of additional information such as 32/64-bit. – Kent May 27 '13 at 22:52
Nice one! I was going made looking for lsb_release or something along those lines. Never would have spotted those scripts. :D – Alastair Feb 8 '14 at 0:43

The command sw_vers shows the version.

For older Mac OS's you can find useful information in Wikipedia.

share|improve this answer

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.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .