--- Python/remote_debug.h
+++ Python/remote_debug.h
@@ -45,9 +45,12 @@
 #    include <sys/mman.h>
 #endif

 #if defined(__APPLE__) && defined(TARGET_OS_OSX) && TARGET_OS_OSX
+#  include "AvailabilityMacros.h"
+#  ifdef MAC_OS_X_VERSION_10_5
 #  include <libproc.h>
+#  endif
 #  include <mach-o/fat.h>
 #  include <mach-o/loader.h>
 #  include <mach-o/nlist.h>
 #  include <mach/error.h>
@@ -526,15 +529,17 @@
             address += size;
             continue;
         }
 
+        #ifdef MAC_OS_X_VERSION_10_5
         int path_len = proc_regionfilename(
             handle->pid, address, map_filename, MAXPATHLEN);
         if (path_len == 0) {
             address += size;
             continue;
         }
+        #endif
 
         char* filename = strrchr(map_filename, '/');
         if (filename != NULL) {
             filename++;  // Move past the '/'
         } else {
