Find Mac OSX version installed using AppleScript

前端 未结 7 2217
夕颜
夕颜 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:32

    Try something along these lines:

    tell application "Terminal"
    activate
    
    set theVersion to do script with command "sw_vers -productVersion"
    end tell
    

    Edit : It was pointed out that this does open the terminal, and that probably isn't the behavior you want.

提交回复
热议问题