diff --git a/test/lib/dir.h b/test/lib/dir.h
index eeb5ab5..ba66f21 100644
--- a/test/lib/dir.h
+++ b/test/lib/dir.h
@@ -8,6 +8,7 @@
 #define TEST_DIR_H

 #include "munit.h"
+#include "unistd.h"

 /* Munit parameter defining the file system type backing the temporary directory
  * created by test_dir_setup().
