--- Python/gc_free_threading.c	2025-07-23 00:42:44.000000000 +0800
+++ Python/gc_free_threading.c	2025-07-30 14:51:41.000000000 +0800
@@ -25,8 +25,9 @@
     #include <unistd.h> // For sysconf, getpid
 #elif defined(__APPLE__)
     #include <mach/mach.h>
-    #include <mach/task.h> // Required for TASK_VM_INFO
+    #include <mach/task.h> // Required for TASK_VM_INFO/TASK_BASIC_INFO
     #include <unistd.h> // For sysconf, getpid
+    #include <AvailabilityMacros.h>
 #elif defined(__FreeBSD__)
     #include <sys/types.h>
     #include <sys/sysctl.h>
@@ -1956,6 +1957,7 @@
 
 #elif defined(__APPLE__)
     // --- MacOS (Darwin) ---
+#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
     // Returns phys_footprint (RAM + compressed memory)
     task_vm_info_data_t vm_info;
     mach_msg_type_number_t count = TASK_VM_INFO_COUNT;
@@ -1967,7 +1969,18 @@
     }
     // phys_footprint is in bytes. Convert to KB.
     return (Py_ssize_t)(vm_info.phys_footprint / 1024);
+#else
+    task_basic_info_data_t info;
+    mach_msg_type_number_t count = TASK_BASIC_INFO_COUNT;
+    kern_return_t kerr;
 
+    kerr = task_info(mach_task_self(), TASK_BASIC_INFO, (task_info_t)&info, &count);
+    if (kerr != KERN_SUCCESS) {
+        return -1;
+    }
+    // resident_size is in bytes. Convert to KB.
+    return (Py_ssize_t)(info.resident_size / 1024);
+#endif
 #elif defined(__FreeBSD__)
     // NOTE: Returns RSS only. Per-process swap usage isn't readily available
     long page_size_kb = sysconf(_SC_PAGESIZE) / 1024;
