diff --git a/source/framework/core/inc/TRestMetadata.h b/source/framework/core/inc/TRestMetadata.h
index e0e51018dec2ac033ab835222de61e8c4c08d629..32f6c20322cbed1acf0a7a8ba7c26123f28153b1 100644
--- a/source/framework/core/inc/TRestMetadata.h
+++ b/source/framework/core/inc/TRestMetadata.h
@@ -43,6 +43,10 @@
 #include "TRestVersion.h"
 #include "tinyxml.h"
 
+#ifndef WIN32
+#include <unistd.h>
+#endif
+
 /* We keep using REST_RELEASE, REST_VERSION(2,X,Y) and REST_VERSION_CODE
    to determine the installed REST version and avoid too much prototyping
 
diff --git a/source/framework/core/src/TRestGDMLParser.cxx b/source/framework/core/src/TRestGDMLParser.cxx
index e5076430308b6efa5ec442d4e4bf540d6a6c48ff..b0023d864274ae533508f4cbfb9e54c45686dd49 100644
--- a/source/framework/core/src/TRestGDMLParser.cxx
+++ b/source/framework/core/src/TRestGDMLParser.cxx
@@ -1,9 +1,6 @@
 #include "TRestGDMLParser.h"
 
 #include <filesystem>
-#ifdef __APPLE__
-#include <unistd.h>
-#endif
 
 using namespace std;
 
diff --git a/source/framework/core/src/startup.cpp b/source/framework/core/src/startup.cpp
index 8e248120821597a0189fa093161594116b45c16f..64c50a1595e99c7b9a9a68b762adf9d8310a5967 100644
--- a/source/framework/core/src/startup.cpp
+++ b/source/framework/core/src/startup.cpp
@@ -4,10 +4,6 @@
 #include <Windows.h>
 #endif  // WIN32
 
-#ifdef __APPLE__
-#include <unistd.h>
-#endif
-
 #include "RVersion.h"
 #include "TEnv.h"
 #include "TRestDataBase.h"
diff --git a/source/framework/tools/inc/TRestTools.h b/source/framework/tools/inc/TRestTools.h
index 81069d1879abdce662bcfe5c6d163cabc74f8313..68f2fa9e354a740578097523e500ae1fa708d9a4 100644
--- a/source/framework/tools/inc/TRestTools.h
+++ b/source/framework/tools/inc/TRestTools.h
@@ -42,6 +42,10 @@
 #define EXTERN_IMP
 #endif
 
+#ifndef WIN32
+#include <unistd.h>
+#endif
+
 const std::string PARAMETER_NOT_FOUND_STR = "NO_SUCH_PARA";
 const double PARAMETER_NOT_FOUND_DBL = -99999999;
 
diff --git a/source/framework/tools/src/TRestStringOutput.cxx b/source/framework/tools/src/TRestStringOutput.cxx
index fe9b3041ac9db751f209de667d0edc1e1a031727..b6500881e7eac93b70dc3c6b43652cebb5d885ea 100644
--- a/source/framework/tools/src/TRestStringOutput.cxx
+++ b/source/framework/tools/src/TRestStringOutput.cxx
@@ -1,5 +1,4 @@
 #include "TRestStringOutput.h"
-
 #include "TRestStringHelper.h"
 
 using namespace std;
@@ -9,10 +8,6 @@ using namespace std;
 #include <conio.h>
 #endif  // WIN32
 
-#ifdef __APPLE__
-#include <unistd.h>
-#endif
-
 int Console::GetWidth() {
 #ifdef WIN32
     CONSOLE_SCREEN_BUFFER_INFO csbi;