diff --git a/gtests/net/packetdrill/platforms.h b/gtests/net/packetdrill/platforms.h
index e277272b1d87deed9569448634451f3a916b9d52..2ecacab88e07a5ae877baef0d106dfb5f1a8c8a6 100644
--- a/gtests/net/packetdrill/platforms.h
+++ b/gtests/net/packetdrill/platforms.h
@@ -106,14 +106,22 @@
 
 #if defined(__APPLE__)
 
+#include <AvailabilityMacros.h>
+
 #if defined(HAVE_SCTP)
 #include <sys/types.h>
 #include <netinet/sctp.h>
 #endif
 #define USE_LIBPCAP             1
 #define HAVE_TCP_INFO           1
+/* open_memstream() and fmemopen() are available in MacOS 10.13 and higher. */
+#if MAC_OS_X_VERSION_MIN_REQUIRED >= 101300
 #define HAVE_FMEMOPEN           1
 #define HAVE_OPEN_MEMSTREAM     1
+#else
+#include "open_memstream.h"
+#include "fmemopen.h"
+#endif
 
 #endif  /* __APPLE__ */
 
diff --git a/gtests/net/packetdrill/run_system_call.c b/gtests/net/packetdrill/run_system_call.c
index 68cc766c0ce079bec10a2ae1406dc4ebf8dd4926..a0e538061e39e0d0bb3c04342fce50fb48bbd399 100644
--- a/gtests/net/packetdrill/run_system_call.c
+++ b/gtests/net/packetdrill/run_system_call.c
@@ -6909,8 +6909,17 @@ static int await_idle_thread(struct state *state)
 	while (state->syscalls->state != SYSCALL_IDLE) {
 		/* On the first time through the loop, calculate end time. */
 		if (end_time.tv_sec == 0) {
+/* clock_gettime is available in MacOS 10.12 and higher. */
+#if !defined(__APPLE__) || (defined(__APPLE__) && (MAC_OS_X_VERSION_MIN_REQUIRED >= 101200))
 			if (clock_gettime(CLOCK_REALTIME, &end_time) != 0)
 				die_perror("clock_gettime");
+#else
+			struct timeval tv;
+
+			if (gettimeofday(&tv, NULL) != 0)
+				die_perror("gettimeofday");
+			TIMEVAL_TO_TIMESPEC(&tv, &end_time);
+#endif
 			end_time.tv_sec += MAX_WAIT_SECS;
 		}
 		/* Wait for a signal or our timeout end_time to arrive. */
diff --git a/gtests/net/packetdrill/symbols_darwin.c b/gtests/net/packetdrill/symbols_darwin.c
index 05cee229e7a5f8e86c899f607cbb6dec01e2599a..9e6b035a9f6ce3259cce67e9dd6bc43f9e4a0057 100644
--- a/gtests/net/packetdrill/symbols_darwin.c
+++ b/gtests/net/packetdrill/symbols_darwin.c
@@ -97,7 +97,9 @@ struct int_symbol platform_symbols_table[] = {
 	{ IP_RECVTTL,                       "IP_RECVTTL"                      },
 	{ IP_PKTINFO,                       "IP_PKTINFO,"                     },
 	{ IP_RECVPKTINFO,                   "IP_RECVPKTINFO"                  },
+#if defined(IP_RECVTOS)
 	{ IP_RECVTOS,                       "IP_RECVTOS"                      },
+#endif
 
 	/* /usr/include/netinet6/in6.h */
 	{ IPV6_UNICAST_HOPS,                "IPV6_UNICAST_HOPS"               },
@@ -452,9 +454,15 @@ struct int_symbol platform_symbols_table[] = {
 	{ F_ADDFILESIGS_FOR_DYLD_SIM,       "F_ADDFILESIGS_FOR_DYLD_SIM"      },
 	{ F_BARRIERFSYNC,                   "F_BARRIERFSYNC"                  },
 	{ F_ADDFILESIGS_RETURN,             "F_ADDFILESIGS_RETURN"            },
+#if defined(F_CHECK_LV)
 	{ F_CHECK_LV,                       "F_CHECK_LV"                      },
+#endif
+#if defined(F_PUNCHHOLE)
 	{ F_PUNCHHOLE,                      "F_PUNCHHOLE"                     },
+#endif
+#if defined(F_TRIM_ACTIVE_FILE)
 	{ F_TRIM_ACTIVE_FILE,               "F_TRIM_ACTIVE_FILE"              },
+#endif
 	{ FCNTL_FS_SPECIFIC_BASE,           "F_UFCNTL_FS_SPECIFIC_BASENLCK"   },
 	{ F_DUPFD_CLOEXEC,                  "F_DUPFD_CLOEXEC"                 },
 	{ FD_CLOEXEC,                       "FD_CLOEXEC"                      },