Find Mac OSX version installed using AppleScript

前端 未结 7 2215
夕颜
夕颜 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:52

    I'm not too familiar with AppleScript, but AFAIK you can get some info about versions from the shell with the sw_vers command. For example:

    Macintosh:~ udekel$ sw_vers
    ProductName:    Mac OS X
    ProductVersion: 10.5.6
    BuildVersion:   9G55
    

    If you can read and parse that from appleScript, that may be a solution, though I'm sure there has to be something more elegant.

提交回复
热议问题