diff --git a/lib/libmagic/config.h b/lib/libmagic/config.h
index 35d090dd48b9..f19fc581f6f5 100644
--- a/lib/libmagic/config.h
+++ b/lib/libmagic/config.h
@@ -127,7 +127,9 @@
 #define HAVE_NEWLOCALE 1
 
 /* Define to 1 if you have the `pipe2' function. */
+#ifndef __APPLE__ /* Cross building tools on macOS */
 #define HAVE_PIPE2 1
+#endif
 
 /* Define to 1 if you have the `pread' function. */
 #define HAVE_PREAD 1