Print The Mac OS X Operating System Version Information From the Terminal

Use:

sw_vers
In my case:
ProductName:    Mac OS X
ProductVersion: 10.6.4
BuildVersion:   10F569
Update: This still works in os x yosemite:
ProductName:    Mac OS X
ProductVersion: 10.10.2
BuildVersion:   14C1514


os x

29 Words

2010-06-24 10:07 +0000