Find Mac OSX version installed using AppleScript

前端 未结 7 2246
夕颜
夕颜 2021-02-15 04:23

How can I find which version of OSX is installed on my Mac by using AppleScript? I want to install an app programatically and run different pkg files based on the version.

7条回答
  •  一个人的身影
    2021-02-15 04:43

    I'm not on a Mac, so there may be a better way to do this, but the first approach that comes to mind is just executing a shell command to query the OS version.

    http://developer.apple.com/technotes/tn2002/tn2065.html#TNTAG2

    http://developer.apple.com/DOCUMENTATION/Darwin/Reference/ManPages/man1/sw_vers.1.html

    Based on these references, you probably want to do something like:

    set os_version to do shell script "sw_vers -productVersion"
    

提交回复
热议问题