title: How do I determine the OS version at runtime in OS X or iOS (without using Gestalt)?
body: <p>The Gestalt() function located in <code>CarbonCore/OSUtils.h</code> has been deprecated as of OS X 10.8 Mountain Lion.</p>
  
  <p>I often use this function to test the version of the OS X operating system at runtime (see the toy example below).</p>
  
  <p>What other API could be used to check the OS X operating system version at runtime in a Cocoa application?</p>
  
  <pre><code>int main() {
      SInt32 versMaj, versMin, versBugFix;
      Gestalt(gestaltSystemVersionMajor, &amp;versMaj);
      Gestalt(gestaltSystemVersionMinor, &amp;versMin);
      Gestalt(gestaltSystemVersionBugFix, &amp;versBugFix);
  
      printf("OS X Version: %d.%d.%d\n", versMaj, versMin, versBugFix);
  }
  </code></pre>