--- a/libguile/filesys.c.orig	2024-09-22 13:46:53.000000000 +0800
+++ b/libguile/filesys.c	2024-09-22 14:12:07.000000000 +0800
@@ -46,6 +46,10 @@
 #include <unistd.h>
 #include <string.h>
 
+#ifdef __APPLE__
+#include <sys/stdio.h> /* for renameat */
+#endif
+
 #ifdef HAVE_DIRECT_H
 #include <direct.h>
 #endif
