How can I get the system version programatically?

[quote=260544:@Norman Palardy]You mean like this ?

        time sw_vers

sw_vers is an apple addition as well :stuck_out_tongue:

uname gives you “something” but not the OS version[/quote]

sw_vers -productName && sw_vers -productVersion | sed 's/10//' Mac OS X .11.4
Cat command

[code]cat /System/Library/CoreServices/SystemVersion.plist

<?xml version="1.0" encoding="UTF-8"?> ProductBuildVersion 15E65 ProductCopyright 1983-2016 Apple Inc. ProductName Mac OS X ProductUserVisibleVersion 10.11.4 ProductVersion 10.11.4 [/code]

I was just commenting on Michel’s comment that " a good old unix command is reliable" yet the unix commands that DO tell you the actual versions are Apples - not “standard built in Unix” commands

thats all

[quote=260550:@Norman Palardy]I was just commenting on Michel’s comment that " a good old unix command is reliable" yet the unix commands that DO tell you the actual versions are Apples - not “standard built in Unix” commands

thats all[/quote]
I agree with both.
Osx terminal have so many commands to play and hidden futures…

[quote=260545:@Loannis Kolliageorgas]Cat command

cat /System/Library/CoreServices/SystemVersion.plist

<?xml version="1.0" encoding="UTF-8"?> ProductBuildVersion 15E65 ProductCopyright 1983-2016 Apple Inc. ProductName Mac OS X ProductUserVisibleVersion 10.11.4 ProductVersion 10.11.4 [/quote]

Apple will not allow you to access this file if you submit to the AppStore…

Thanks for the update
Then i will put it on blacklist :slight_smile:

Please don’t give Apple any more ideas on what they can remove/break in the next OS update.

Radar: Remove command line system_profiler

I’ve updated several apps lately to stop using the gestault command because it spams the system log warning you that it is no longer going to return the correct OS version, that it stopped updating a couple of versions ago or something. Even though I was only using it to turn off some modern things in old OS versions and still worked even reporting the wrong OS version. Unfortunately I was getting reports from users who’s apps were working perfectly but thought I should know about this debug log output from Apple :wink: So they succeeded in getting me to stop using it.

Gestalt is deprecated since Mac OS X 10.8

MBS Plugin will use NSProcessInfo on newer Macs and Gestalt on older.
For Windows we use special methods to query newer version of OS.
Windows like to lie about version if your manifest doesn’t include a hint about explicit support of newer version.