--- src/posix.h.orig 2015-10-05 14:37:22.000000000 -0700 +++ src/posix.h 2015-10-06 10:59:08.000000000 -0700 @@ -132,6 +132,19 @@ #include "strnlen.h" +#ifdef __APPLE__ +#include <Availability.h> +#if __MAC_OS_X_VERSION_MIN_REQUIRED <= 1060 +static size_t +strnlen (const char *string, size_t maxlen) +{ + const char *end = memchr (string, '\0', maxlen); + return end ? (size_t) (end - string) : maxlen; +} +# define p_strnlen strnlen +#endif +#endif + #ifdef NO_READDIR_R GIT_INLINE(int) p_readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result) {