1diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
2index 40229bce0f..3cc604930e 100644
3--- a/Modules/posixmodule.c
4+++ b/Modules/posixmodule.c
5@@ -7258,7 +7258,7 @@ os_sched_getaffinity_impl(PyObject *module, pid_t pid)
6 #ifdef HAVE_UTMP_H
7 #include <utmp.h>
8 #endif /* HAVE_UTMP_H */
9-#elif defined(HAVE_LIBUTIL_H)
10+#elif defined(HAVE_LIBUTIL_H) && !defined(__APPLE__)
11 #include <libutil.h>
12 #elif defined(HAVE_UTIL_H)
13 #include <util.h>