MacOS version ( alternative for System.Gestalt )

Since System.Gestalt is depreciated since Xojo 2014r3 is there any other way of getting the MacOS version?

I know that “depreciated” does not mean “removed”. But I like clean code. And since I am fixing a lot of code to work well with the API 2.0, I wanted to tackle the OS version as wel.

Apple wrote:
[b]Warning

The underlying Gestalt Manager API is deprecated; use version and sysctl instead of this function.[/b]

And here’s both links:
https://developer.apple.com/documentation/installerjs/system/1812284-version
https://developer.apple.com/documentation/installerjs/system/1812308-sysctl

[quote=462997:@Emile Schwarz]Apple wrote:
[b]Warning

The underlying Gestalt Manager API is deprecated; use version and sysctl instead of this function.[/b]

And here’s both links:
https://developer.apple.com/documentation/installerjs/system/1812284-version
https://developer.apple.com/documentation/installerjs/system/1812308-sysctl[/quote]

Thanks! I think this might work. I used the sesctl to get the right information.
The code below is not yet tested. But I assume it should work:

[code]Public Sub osVersion(byRef Major as Integer, byRef Minor as Integer, byRef Bug as Integer)
dim selector as String = “kern.osrelease”

dim sh as new Shell
sh.ExecuteMode = shell.ExecuteModes.Synchronous
sh.Execute "sysctl " + selector

dim result as String
result = sh.Result

if result.Trim = “” then Return
if not result.Trim.BeginsWith( selector ) then Return

dim i as Integer
i = result.IndexOf(":")
if i < 0 then Return
result = result.Middle(i + 1).Trim

dim flds() as String = result.Split(".")
if flds.LastRowIndex < 2 then Return

Major = flds(0).CLong
Minor = flds(1).CLong
Bug = flds(2).CLong
End Sub
[/code]

NSProcessInfo

You use MBS Plugin?

Then please check NSProcessInfoMBS class or SystemInformationMBS Modul.

a long thread with several options
plugins and non-plugins alike
https://forum.xojo.com/conversation/post/318763

Go here and download the OS X Version Information code.
https://ohanaware.com/xojo/