Index: gap-4.12.2/src/gaptime.c
===================================================================
--- gap-4.12.2.orig/src/gaptime.c
+++ gap-4.12.2/src/gaptime.c
@@ -35,7 +35,7 @@
 #include <sys/resource.h>
 #endif
 
-#if defined(__MACH__) // macOS
+#if defined(__MACH__) && defined(__APPLE__) // macOS
 #include <mach/mach_time.h>
 #elif defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC)
 #include <time.h>
@@ -91,7 +91,7 @@ Int8 SyNanosecondsSinceEpoch(void)
 {
     Int8 res;
 
-#if defined(__MACH__) // macOS
+#if defined(__MACH__) && defined(__APPLE__) // macOS
     static mach_timebase_info_data_t timeinfo;
     if (timeinfo.denom == 0) {
         (void)mach_timebase_info(&timeinfo);
@@ -151,7 +151,7 @@ static Int8 SyNanosecondsSinceEpochResol
 {
     Int8 res;
 
-#if defined(__MACH__)
+#if defined(__MACH__) && defined(__APPLE__)
     static mach_timebase_info_data_t timeinfo;
     if (timeinfo.denom == 0) {
         (void)mach_timebase_info(&timeinfo);
@@ -259,7 +259,7 @@ static Obj FuncNanosecondsSinceEpochInfo
     const char * method = "unsupported";
     Int          monotonic = 0;
 
-#if defined(__MACH__)
+#if defined(__MACH__) && defined(__APPLE__)
     method = "mach_absolute_time";
     monotonic = 1;
 #elif defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC)
Index: gap-4.12.2/src/system.c
===================================================================
--- gap-4.12.2.orig/src/system.c
+++ gap-4.12.2/src/system.c
@@ -51,7 +51,7 @@
 
 #include <sys/stat.h>
 
-#ifdef __MACH__
+#if defined(__MACH__) && defined(__APPLE__)
 // Workaround: TRUE / FALSE are also defined by the OS X Mach-O headers
 #define ENUM_DYLD_BOOL
 #include <mach-o/dyld.h>
