diff --git a/MagickCore/method-attribute.h b/MagickCore/method-attribute.h
index 80f99f6..a0b0e77 100644
--- a/MagickCore/method-attribute.h
+++ b/MagickCore/method-attribute.h
@@ -123,6 +123,12 @@
# define magick_unreferenced(x) /* nothing */
#endif
+#if defined(__apple_build_version__)
+# define magick_alloc_size(x) __attribute__((__alloc_size__(x)))
+# define magick_alloc_sizes(x,y) __attribute__((__alloc_size__(x,y)))
+# define magick_cold_spot
+# define magick_hot_spot
+#else
#if defined(__clang__) || (((__GNUC__) > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)))
# define magick_alloc_size(x) __attribute__((__alloc_size__(x)))
# define magick_alloc_sizes(x,y) __attribute__((__alloc_size__(x,y)))
@@ -134,6 +140,7 @@
# define magick_cold_spot
# define magick_hot_spot
#endif
+#endif
#if defined(__cplusplus) || defined(c_plusplus)
}