diff --git a/tests/dns.c b/tests/dns.c
index b05178c..9e89027 100644
--- a/tests/dns.c
+++ b/tests/dns.c
@@ -24,6 +24,10 @@
 #include <netinet/in.h>
 #include <sys/stat.h>
 #include <arpa/nameser.h>
+#ifdef DARWIN
+#define BIND_8_COMPAT
+#include <arpa/nameser_compat.h>
+#endif
 
 #include "common.h"
 #include "dns.h"