Skip to main content
Answer

Extension Attribute to pull OS build number?

  • April 19, 2012
  • 4 replies
  • 26 views

donmontalvo
Forum|alt.badge.img+36

Ok, any script gurus here who can help us cobble together an Extension Attribute to capture and display the OS build number? Please point me to any existing method if I missed it. :)

Here's what we have:

$ system_profiler | grep "System Version: Mac OS X" | awk '{ print $6 $7 }'
2012-04-19 13:51:15.146 system_profiler[13331:60b] CFURLCreateWithString was passed this invalid URL string: '/System/Library/Image%20Capture/Devices/TWAINBridge.app' (a file system path instead of an URL string). The URL created will not work with most file URL functions. CFURLCreateWithFileSystemPath or CFURLCreateWithFileSystemPathRelativeToBase should be used instead.
10.7.3(11D50)

The very last part of the output is what we need...not sure what the goobleygook stuff is before it. Is there a better way to get the desired output (in this case "10.7.3(11D50)")? :)

TIA

Don

Best answer by nessts

sw_vers ProductName: Mac OS X
ProductVersion: 10.7.3
BuildVersion: 11D50

4 replies

Forum|alt.badge.img+18
  • Valued Contributor
  • Answer
  • April 19, 2012

sw_vers ProductName: Mac OS X
ProductVersion: 10.7.3
BuildVersion: 11D50


Forum|alt.badge.img+13

sw_vers -buildVersion

check the man page.


mm2270
Forum|alt.badge.img+24
  • Legendary Contributor
  • April 19, 2012

Yeah, 'sw_vers' is what i always use when looking to pull the OS and build info via a script. Forget system_profiler, too much overhead for just pulling that data.


donmontalvo
Forum|alt.badge.img+36
  • Author
  • Hall of Fame
  • April 19, 2012

@rockpapergoat Thanks...tested fine, the asset team sends their thanks!