diff --git a/apps/openmw/main.cpp b/apps/openmw/main.cpp
index a7e522acd..9e44f237e 100644
--- a/apps/openmw/main.cpp
+++ b/apps/openmw/main.cpp
@@ -20,6 +20,9 @@
 #include <cstdlib>
 #endif
 
+#if (defined(__APPLE__) || defined(__linux) || defined(__unix) || defined(__posix))
+#include <unistd.h>
+#endif
 
 #if (defined(__APPLE__) || (defined(__linux)  &&  !defined(ANDROID)) || (defined(__unix) &&  !defined(ANDROID)) || defined(__posix))
     #define USE_CRASH_CATCHER 1