diff --git a/res/res_http_post.c b/res/res_http_post.c
index 0f2373730731ccc4acfbd3f0fa0a1949ebb64e7d..c0719b6dab56c040359fd6ed47656925656ed5ab 100644
--- a/res/res_http_post.c
+++ b/res/res_http_post.c
@@ -37,7 +37,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <gmime/gmime.h>
-#if defined (__OpenBSD__) || defined(__FreeBSD__)
+#if defined (__OpenBSD__) || defined(__FreeBSD__) || defined(__Darwin__)
 #include <libgen.h>
 #endif