I frequently find myself SSHing into various OS X machines, and it'd be useful if I could tell what version of OS X I was on when I'm doing that. uname -a
doesn't quite work, since Darwin kernel versions don't always change with the rest of the system.
How to Check OS X Version from Command Line
osxsshversion
Best Answer
sw_vers
My suggestion is to use
sw_vers
. Example output as of 10.6.4:The answer that suggested
system_profiler | grep 'System Version'
is what I have tried to use in the past, but it has 2 problems.grep
for 'Serial Number' on 10.6.4 is "Serial Number (system): ZNNNNNZNZZZ", whereas on 10.4.11 it was "Serial Number: ZNNNNZNZZZZ" - importance being the parse-ability of the output and the add " (system)" piece can be problematic unless you are expecting the change.