--- configure.ac.orig	2026-03-11 02:51:47.000000000 -0700
+++ configure.ac	2026-03-14 16:14:52.000000000 -0700
@@ -446,7 +446,8 @@ AS_CASE(["$build_os"],
 	      -e '^ld: warning: text-based stub file' \
 	      -e '^ld: warning: -multiply_defined is obsolete' \
 	   >/dev/null], [
-	suppress_ld_waring=yes
+	CC_WRAPPER=`cd -P "${tooldir}" && pwd`/darwin-cc
+	CC="$CC_WRAPPER $CC"
     ])
     rm -fr conftest*
     test $suppress_ld_waring = yes && warnflags="${warnflags:+${warnflags} }-Wl,-w"
--- file.c.orig	2026-03-11 02:51:47.000000000 -0700
+++ file.c	2026-03-14 16:14:52.000000000 -0700
@@ -275,9 +275,27 @@ static CFMutableStringRef
 mutable_CFString_new(CFStringRef *s, const char *ptr, long len)
 {
     const CFAllocatorRef alloc = kCFAllocatorDefault;
+
+/*
+ * The 'NoCopy' version of CFStringCreateWithBytes didn't appear until
+ * 10.5, though the original CFStringCreateWithBytes has been available
+ * since 10.0.  Hence, we need to use CFStringCreateWithBytes on OS versions
+ * earlier than 10.5.
+ *
+ * There's probably no significant benefit to using the 'NoCopy' version
+ * in this context, so making that substitution unconditionally would
+ * probably be fine (and simpler), but by the principle of least change,
+ * we limit the substitution to earlier OS versions (i.e., 10.4).
+ */
+# if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1050
     *s = CFStringCreateWithBytesNoCopy(alloc, (const UInt8 *)ptr, len,
                                        kCFStringEncodingUTF8, FALSE,
                                        kCFAllocatorNull);
+# else /* 10.4 */
+    *s = CFStringCreateWithBytes(alloc, (const UInt8 *)ptr, len,
+                                 kCFStringEncodingUTF8, FALSE);
+# endif /* 10.4 */
+
     return CFStringCreateMutableCopy(alloc, len, *s);
 }
 
--- lib/bundler/gem_helper.rb.orig	2026-03-11 02:51:47.000000000 -0700
+++ lib/bundler/gem_helper.rb	2026-03-14 16:14:52.000000000 -0700
@@ -231,7 +231,7 @@ module Bundler
     end
 
     def gem_command
-      ENV["GEM_COMMAND"]&.shellsplit || ["gem"]
+      ENV["GEM_COMMAND"]&.shellsplit || ["gem3.4"]
     end
   end
 end
--- thread_pthread.c.orig	2026-03-11 02:51:47.000000000 -0700
+++ thread_pthread.c	2026-03-14 16:14:52.000000000 -0700
@@ -43,6 +43,22 @@
 
 #if defined __APPLE__
 # include <AvailabilityMacros.h>
+
+/*
+ * This code is built with _XOPEN_SOURCE=1 and _DARWIN_C_SOURCE=1, which
+ * blocks the declaration of pthread_mach_thread_np() in pthread.h on 10.4.
+ * Overriding this by also defining _DARWIN_C_SOURCE didn't become available
+ * until 10.5.  The missing prototype went unnoticed until gcc14 started
+ * calling it an error.
+ *
+ * Note that many uses of Apple-specific functions with these settings are
+ * illegal (on 10.4), but for now we just fix the immediate problem by
+ * duplicating the missing declaration.  There's no need to make this
+ * conditional, since redundant prototypes are legal.
+ */
+#include <mach/port.h>
+mach_port_t 	pthread_mach_thread_np(pthread_t);
+
 #endif
 
 #if defined(HAVE_SYS_EVENTFD_H) && defined(HAVE_EVENTFD)
