--- osdep/macosx_compat.h.orig
+++ osdep/macosx_compat.h
@@ -41,6 +41,15 @@
 - (void)setObject: (id)object forKeyedSubscript:(id)key;
 @end
 
+/* Don't blindly redefine YES and NO, undefine them first. */
+#ifdef YES
+    #undef YES
+#endif
+
+#ifdef NO
+    #undef NO
+#endif
+
 #if __has_feature(objc_bool)
     #define YES  __objc_yes
     #define NO   __objc_no
