Mac OS Xのバージョンをコマンドラインから確認する。

iBook:~ hoge$ sw_vers
ProductName:    Mac OS X
ProductVersion: 10.5.2
BuildVersion:   9C7010


iBook:~ hoge$ whereis sw_vers
/usr/bin/sw_vers


iBook:~ hoge$ strings /usr/bin/sw_vers
Usage: sw_vers [-productName|-productVersion|-buildVersion]
-productName
-productVersion
-buildVersion
-XBSVersion
**** ERROR **** Can't get version dictionary
**** ERROR **** Can't get ProductName from version dictionary
**** ERROR **** Can't convert ProductName to CString
**** ERROR **** Can't get ProductVersion from version dictionary
**** ERROR **** Can't convert ProductVersion to CString
**** ERROR **** Can't get ProductBuildVersion from version dictionary
**** ERROR **** Can't convert ProductBuildVersion to CString
XBS Version
**** ERROR **** Can't convert XBSVersion to CString
ProductName:
ProductVersion:
BuildVersion:
XBS Version: 


このファイルを参照されてる。

iBook:~ furuyamanobuyuki$ cat /System/Library/CoreServices/SystemVersion.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>ProductBuildVersion</key>
    <string>9C7010</string>
    <key>ProductCopyright</key>
    <string>1983-2007 Apple Inc.</string>
    <key>ProductName</key>
    <string>Mac OS X</string>
    <key>ProductUserVisibleVersion</key>
    <string>10.5.2</string>
    <key>ProductVersion</key>
    <string>10.5.2</string>
</dict>
</plist>