how to find out mac os x version via command line

sharktt

Registered
Hello all,

I'm in the process of writing a script that probes versions of OS on various macs, they vary from 10.1.x to 10.3.5

uname -a provides kernel information like 7.x.x will equal 10.3.x and 6.x will equal 10.2. Is there a way to get
any kind of output to say: mac os x version 10.3.4 bld 7Mxx?

Thanks for your time,

-SharkTT ::alien::
 
I don't know of a way to check the build numbers via the terminal, but I'd be happy to share what data I've collected on Mac OS X and related operating systems version numbers.

As Mac OS X derives much of it's heritage from earlier NeXT releases, here is a list of the NeXT/Apple OS from version 0.8 to 5.6:
  • NeXTstep 0.8
  • NeXTstep 1.0
  • NeXTSTEP 2.0
  • NeXTSTEP 2.1
  • NEXTSTEP 3.0
  • NEXTSTEP 3.1
  • NEXTSTEP 3.2
  • NEXTSTEP 3.3
  • OPENSTEP 4.0
  • OPENSTEP 4.1
  • OPENSTEP 4.2
  • Rhapsody Developer Release (Rhapsody 5.0)
  • Rhapsody Developer Release 2 (Rhapsody 5.1)
  • Rhapsody Premier (Rhapsody 5.2- never released)
  • Mac OS X Server 1.0 (Rhapsody 5.3)
  • Mac OS X Server 1.0.1 (Rhapsody 5.4)
  • Mac OS X Server 1.0.2 (Rhapsody 5.5)
  • Mac OS X Server 1.2 (Rhapsody 5.6)
  • Mac OS X Server 1.2 v.3 (Rhapsody 5.6 also)

After the release of Rhapsody 5.1 Apple started work on Mac OS X. The versions for Mac OS X are as follows:
  • Mac OS X Developer Preview
  • Mac OS X Developer Preview 2
  • Mac OS X Developer Preview 2.6 (aqua demo)
  • Mac OS X Developer Preview 3
  • Mac OS X Developer Preview 4
  • Mac OS X Public Beta
  • Mac OS X v. 10.0 (10.0.0-10.0.4)
  • Mac OS X v. 10.1 (10.1.0-10.1.5)
  • Mac OS X v. 10.2 (10.2.0-10.2.8)
  • Mac OS X v. 10.3 (10.3.0-10.3.5)

When Apple started Mac OS X they felt a need to relieve themselves of some undue licensing restrictions that had been following the NeXT/Apple OS from it's conception in the late 1980s. The new foundation was named Darwin. Here are the releases (that correspond to Mac OS X releases):
  • Mac OS 10.0 (Mac OS X Developer Preview)
  • Mac OS 10.0 (Mac OS X Developer Preview 2)
  • Darwin 1.0 (Mac OS X Developer Preview 3)
  • Darwin 1.1 (Mac OS X Developer Preview 4)
  • Darwin 1.2.1 (Mac OS X Public Beta)
  • Darwin 1.3.1 (Mac OS X v. 10.0)
  • Darwin 1.4.1 (Mac OS X v. 10.1)
  • Darwin 5.1-5.5 (Mac OS X v. 10.1.1-10.1.5)
  • Darwin 6.0-6.8 (Mac OS X v. 10.2.0-10.2.8)
  • Darwin 7.0-7.5 (Mac OS X v. 10.3.0-10.3.5)*

I think that is a pretty complete listing to date. The Darwin list is the hardest to follow as Apple changed the version numbers with Mac OS X 10.1.1, and that the earliest developer previews displayed Mac OS 10.0 rather than Darwin.


*for some reason 10.3.1 displays Darwin 7.0 when it should have been 7.1
 
system_profiler SPSoftwareDataType

will tell you the OS X release number, as opposed to the Darwin kernel version. But, as RacerX pointed out, they have actually come out with a new Darwin kernel point release each time there has been a point release of OS X - with the exception of 10.3.1, which I never noticed.

I have always wondered - was the jump from 1.4.1 to 5.1 deliberate, or did someone actually mess up the version numbers, and then they decided to stick with it? I mean, it's not like 10.1 to 10.1.1 was a very big change; I'd be surprised if they really went through four major overhauls to the kernel in that time...
 
scruffy said:
I have always wondered - was the jump from 1.4.1 to 5.1 deliberate, or did someone actually mess up the version numbers, and then they decided to stick with it?
They did it to make Darwin's whole number version match the first number of the build number of Mac OS X and the first decimal to match Mac OS X second point number. Basically to help developers in keeping Mac OS X and Darwin version numbers straight. They sent out a developer note to everyone on their developer lists explaining the change.

I would guess people complained that keeping Darwin and Mac OS X version numbers straight was rather hard. My guess is that they finished the new numbering scheme after the final version of 10.1 had been sent to be placed on media (in the form of new install CDs or update CDs). Apple most likely thought that it wasn't so important that it couldn't wait until the 10.1.1 update.

As for the issue with 10.3.1, I think it was rushed out the door and some one forgot to change the Darwin version ID. It was the only time I've noticed this and was fixed by 10.3.2 (which displayed the proper 7.2 Darwin version).
 
Ah, that makes sense.

There's also an sw_vers command. This I found out by reading through a recently (widely) publicized rootkit for OS X...
 
Also:
uname -r
will give you the kernel version on nearly any unix-like system without needing to grep or awk/sed.

But, you probably already noticed that
 
Back
Top