Alex Rivera | Logout

Find Mac OSX version installed using AppleScript

Asked 2009-01-31T05:20:08.190
11

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.

Thanks

Edit
Report

2 Answers

22

Here is how to get OSX version in AppleScript, using built-in functions:

set sysinfo to system info
set osver to system version of sysinfo

On OS X Mavericks the result is "10.9".

One-liner: set osver to system version of (system info)

answered 2011-07-25T01:28:09.713
2

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.

answered 2009-01-31T05:36:38.937

Your Answer