Skip to content

Instantly share code, notes, and snippets.

@torarnv
Last active March 9, 2026 09:14
Show Gist options
  • Select an option

  • Save torarnv/4967079 to your computer and use it in GitHub Desktop.

Select an option

Save torarnv/4967079 to your computer and use it in GitHub Desktop.
Availability macros (Availability.h AvailabilityMacros.h AvailabilityInternal.h) notes
MACOSX_DEPLOYMENT_TARGET environment variable or -mmacosx-min-version= on the command line
results in the define __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ being set, which is
then picked up by AvailabilityMacros.h and Availability(Internal).h
The result is MAC_OS_X_VERSION_MIN_REQUIRED being set (AvailabilityMacros.h)
and __MAC_OS_X_VERSION_MIN_REQUIRED (Availability.h)
The same goes for MAC_OS_X_VERSION_MAX_ALLOWED (AvailabilityMacros.h) and
and __MAC_OS_X_VERSION_MAX_ALLOWED (Availability.h), which is set to the
SDK version (unless set, for example to fake/check what happens when building
against an earlier SDK without the SDK being available).
AvailabilityMacros.h use the MAC_OS_X_VERSION_10_8 form to check for versions
which are then defined to eg 1080. Availability.h uses __MAC_10_8 which has
the same define value, and __IPHONE_5_1 with value 50100.
It's reccomended to never use the names, but instead use the values, in case
you're not building against an SDK with that define set.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment