I have a program which needs to behave slightly differently on Tiger than on Leopard. Does anybody know of a system call which will allow me to accurately determine which version of Mac OS X I am running. I have found a number of macro definitions to determine the OS of the build machine, but nothing really good to determine the OS of the running machine.
Thanks, Joe
See this article here
But in short, if you’re using carbon, use the Gestalt() call, and if you’re using cocoa, there is a constant called NSAppKitVersionNumber which you can simply check against.
Edit: For Mac OSX 10.8 and above, don’t use Gestalt() anymore. See this answer for more details: How do I determine the OS version at runtime in OS X or iOS (without using Gestalt)?