diff --git a/src/global.h b/src/global.h
index 504620f7d0b2d903cde4d468be62aeeec85c1218..e8618e109c447285f700139c61f52752cba25450 100644
--- a/src/global.h
+++ b/src/global.h
@@ -602,7 +602,7 @@ typedef struct p_wchar_p
  * themselves, unless they are compiled statically. */
 #   define PMOD_EXPORT __declspec(dllexport)
 #  endif
-# elif defined(__clang__) && defined(MAC_OS_X_VERSION_MIN_REQUIRED)
+# elif defined(__clang__) && (defined(MAC_OS_X_VERSION_MIN_REQUIRED) || defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__))
 /* According to Clang source the protected behavior is ELF-specific and not
    applicable to OS X. */
 #  define PMOD_EXPORT    __attribute__ ((visibility("default")))