diff --git a/contrib/sb-grovel/def-to-lisp.lisp b/contrib/sb-grovel/def-to-lisp.lisp
index fceabeb..41b88ee 100644
--- a/contrib/sb-grovel/def-to-lisp.lisp
+++ b/contrib/sb-grovel/def-to-lisp.lisp
@@ -206,9 +206,12 @@ code:
                         "-D_LARGEFILE64_SOURCE"
                         "-D_FILE_OFFSET_BITS=64")
                       #+(and x86-64 darwin)
-                      '("-arch" "x86_64")
+                      '("-arch" "x86_64"
+                        "-mmacosx-version-min=10.5"
+                        "-D_DARWIN_USE_64_BIT_INODE")
                       #+(and x86 darwin)
-                      '("-arch" "i386")
+                      '("-arch" "i386"
+                        "-mmacosx-version-min=10.4")
                       #+(and x86-64 sunos) '("-m64")
                       (list "-o"
                             (namestring tmp-a-dot-out)
diff --git a/contrib/sb-posix/interface.lisp b/contrib/sb-posix/interface.lisp
index d40fd7d..5356177 100644
--- a/contrib/sb-posix/interface.lisp
+++ b/contrib/sb-posix/interface.lisp
@@ -514,7 +514,9 @@
 
 (defmacro define-stat-call (name arg designator-fun type)
   ;; FIXME: this isn't the documented way of doing this, surely?
-  (let ((lisp-name (lisp-for-c-symbol name)))
+  (let ((lisp-name (lisp-for-c-symbol name))
+        (real-name #+(and darwin x86-64) (format nil "~A$INODE64" name)
+                   #-(and darwin x86-64) name))
     `(progn
       (export ',lisp-name :sb-posix)
       (declaim (inline ,lisp-name))
@@ -522,7 +524,7 @@
         (declare (type (or null stat) stat))
         (with-alien-stat a-stat ()
           (let ((r (alien-funcall
-                    (extern-alien ,(real-c-name (list name :options :largefile)) ,type)
+                    (extern-alien ,(real-c-name (list real-name :options :largefile)) ,type)
                     (,designator-fun ,arg)
                     a-stat)))
             (when (minusp r)
diff --git a/contrib/sb-posix/posix-tests.lisp b/contrib/sb-posix/posix-tests.lisp
index 69a00a7..5ef093e 100644
--- a/contrib/sb-posix/posix-tests.lisp
+++ b/contrib/sb-posix/posix-tests.lisp
@@ -213,7 +213,6 @@
         result)))
   #.sb-posix::eacces)
 
-#-darwin
 (deftest stat.1
   (let* ((stat (sb-posix:stat *test-directory*))
          (mode (sb-posix::stat-mode stat)))
@@ -221,7 +220,7 @@
     (logand mode (logior sb-posix::s-iread sb-posix::s-iwrite sb-posix::s-iexec)))
   #.(logior sb-posix::s-iread sb-posix::s-iwrite sb-posix::s-iexec))
 
-#-(or darwin win32)
+#-win32
 (deftest stat.2
   (let* ((stat (sb-posix:stat "/"))
          (mode (sb-posix::stat-mode stat)))
@@ -242,7 +241,7 @@
     (< (- atime unix-now) 10))
   t)
 
-#-(or darwin win32)
+#-win32
 (deftest stat.4
   (let* ((stat (sb-posix:stat (make-pathname :directory '(:absolute :up))))
          (mode (sb-posix::stat-mode stat)))
@@ -331,7 +330,6 @@
     (sb-posix:s-isreg mode))
   nil)
 
-#-darwin
 (deftest stat-mode.2
   (with-stat-mode (mode *test-directory*)
     (sb-posix:s-isdir mode))
@@ -358,7 +356,7 @@
     (sb-posix:s-issock mode))
   nil)
 
-#-(or win32 darwin)
+#-win32
 (deftest stat-mode.7
   (let ((link-pathname (make-pathname :name "stat-mode.7"
                                       :defaults *test-directory*)))
@@ -370,7 +368,6 @@
       (ignore-errors (sb-posix:unlink link-pathname))))
   t)
 
-#-darwin
 (deftest stat-mode.8
   (let ((pathname (make-pathname :name "stat-mode.8"
                                  :defaults *test-directory*)))
@@ -611,12 +608,12 @@
   t)
 
 
-#-(or darwin win32)
+#-win32
 (deftest time.1
     (plusp (sb-posix:time))
   t)
 
-#-(or darwin win32)
+#-win32
 (deftest utimes.1
     (let ((file (merge-pathnames #p"utimes.1" *test-directory*))
           (atime (random (1- (expt 2 31))))
diff --git a/make-config.sh b/make-config.sh
old mode 100644
new mode 100755
index 81877e7..3b3b76c
--- a/make-config.sh
+++ b/make-config.sh
@@ -143,6 +143,16 @@ fi
 printf ":%s" "$sbcl_arch" >> $ltf
 
 echo //setting up OS-dependent information
+
+# Under Darwin x86-64, guess whether Darwin 9+ or below.
+if [ "$sbcl_os" = "darwin" ] && [ "$sbcl_arch" = "x86-64" ]; then
+	darwin_version=`uname -r`
+	darwin_version_major=${darwin_version%%.*}
+	if (( 8 < $darwin_version_major )); then
+		ver9_or_above="9+"
+	fi
+fi
+
 original_dir=`pwd`
 cd ./src/runtime/
 rm -f Config target-arch-os.h target-arch.h target-os.h target-lispregs.h
@@ -233,7 +243,7 @@ case "$sbcl_os" in
         fi
         link_or_copy $sbcl_arch-darwin-os.h target-arch-os.h
         link_or_copy bsd-os.h target-os.h
-        link_or_copy Config.$sbcl_arch-darwin Config
+        link_or_copy Config.$sbcl_arch-darwin$ver9_or_above Config
         ;;
     sunos)
         printf ' :unix' >> $ltf
diff --git a/src/runtime/Config.x86-64-darwin9+ b/src/runtime/Config.x86-64-darwin9+
new file mode 100644
index 0000000..3da837d
--- /dev/null
+++ b/src/runtime/Config.x86-64-darwin9+
@@ -0,0 +1,31 @@
+# -*- makefile -*- for the C-level run-time support for SBCL
+
+# This software is part of the SBCL system. See the README file for
+# more information.
+#
+# This software is derived from the CMU CL system, which was
+# written at Carnegie Mellon University and released into the
+# public domain. The software is in the public domain and is
+# provided with absolutely no warranty. See the COPYING and CREDITS
+# files for more information.
+
+CFLAGS = -g -Wall -O2 -fdollars-in-identifiers -mmacosx-version-min=10.5 -D_DARWIN_USE_64_BIT_INODE
+LINKFLAGS += -mmacosx-version-min=10.5
+OS_SRC = bsd-os.c x86-64-bsd-os.c darwin-os.c x86-64-darwin-os.c darwin-dlshim.c darwin-langinfo.c
+OS_LIBS = -lSystem -lc -ldl
+ifdef LISP_FEATURE_SB_THREAD
+  OS_LIBS += -lpthread
+endif
+
+ASSEM_SRC = x86-64-assem.S ldso-stubs.S
+ARCH_SRC = x86-64-arch.c
+
+LINKFLAGS += -arch x86_64 -dynamic -twolevel_namespace -bind_at_load -pagezero_size 0x100000
+
+CFLAGS += -arch x86_64 -fno-omit-frame-pointer -pagezero_size 0x100000
+
+GC_SRC = gencgc.c
+
+# Nothing to do for after-grovel-headers.
+.PHONY: after-grovel-headers
+after-grovel-headers:
diff --git a/tools-for-build/ldso-stubs.lisp b/tools-for-build/ldso-stubs.lisp
index 8fa13b0..d8e5144 100644
--- a/tools-for-build/ldso-stubs.lisp
+++ b/tools-for-build/ldso-stubs.lisp
@@ -220,6 +220,7 @@ ldso_stub__ ## fct: ;                  \\
                    "fork"
                    "free"
                    "fstat"
+                   #!+(and darwin x86-64) "fstat$INODE64"
                    "fsync"
                    "ftruncate"
                    "getcwd"
@@ -250,6 +251,7 @@ ldso_stub__ ## fct: ;                  \\
                    "log1p"
                    "lseek"
                    "lstat"
+                   #!+(and darwin x86-64) "lstat$INODE64"
                    "malloc"
                    "memmove"
                    "mkdir"
@@ -274,6 +276,7 @@ ldso_stub__ ## fct: ;                  \\
                    "sinh"
                    "socket"
                    "stat"
+                   #!+(and darwin x86-64) "stat$INODE64"
                    "strerror"
                    "strlen"
                    "symlink"
