Server Fault is a question and answer site for system and network administrators. 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

In Red Hat the file /etc/redhat-release contains the operating system version data (such as "Red Hat release X.X (Final)").

Is there any similar mechanism in Mac OS X that can be used programatically to get the operating system version data (such as "Mac OS X 10.5.8")?

share|improve this question
up vote 3 down vote accepted

In case you are looking for more details to the kernel, you can also query the sysctl interface which provides the kernel ostype, version and other details.

  • To get the ostype : sysctl kern.ostype
  • To get the osversion : sysctl kern.osversion
  • To get the version : sysctl kern.version
  • To get the osrevision : sysctl kern.osrevision

More details here :

share|improve this answer
Just FYI: On Ubuntu, it's "kernel" instead of "kern". And for these keys, the output is the same as uname -a (or the various subsets from other options like -s, -r, -v, etc.) – Dennis Williamson Sep 6 '09 at 22:01
uname -a on a Mac: "Darwin <machine name>.local 9.8.0 Darwin Kernel Version 9.8.0: Wed Jul 15 16:55:01 PDT 2009; root:xnu-1228.15.4~1/RELEASE_I386 i386" – warren Sep 7 '09 at 3:21

Found the answer:

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.