Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Version info from the command line System
In this MacWorld forum thread, JohnKFisher asked about getting OS X version info when connecting via SSH to another OS X box. After some back and forth, PaulM contributed the easy way to get this info:
[11:13am robg ~]% sw_vers
ProductName: Mac OS X
ProductVersion: 10.0.4
BuildVersion: 4Q12
Just type 'sw_vers' and you'll get the info on what version of OS X you've connected to. PaulM also points out that the traditional UNIX command is 'uname -a', and that this returns Darwin information on OS X:
[11:13am robg ~]% uname -a
Darwin localhost 1.3.7 Darwin Kernel Version 1.3.7: Sat Jun 9 11:12:48 PDT 2001;
root:xnu/xnu-124.13.obj~1/RELEASE_PPC Power Macintosh powerpc
[Carriage return added for easier readability]
    •    
  • Currently 0.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (0 votes cast)
 
[2,791 views]  

Version info from the command line | 1 comments | Create New Account
Click here to return to the 'Version info from the command line' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
and for prompts
Authored by: davey_w on Jun 12, '02 10:50:15AM

this line will extract just the version number - e.g. 10.1.5 - from sw_vers:

sw_vers | sed -n '/([0-9].)/s/.*: //p'

make sure you manually type the tab after the colon rather than just copying & pasting.

I use it in my prompt.



[ Reply to This | # ]