diff --git a/README.md b/README.md
--- a/README.md
+++ b/README.md
@@ -82,3 +82,4 @@
 * [Michael Xavier](https://github.com/MichaelXavier)
 * [Doug Beardsley](https://github.com/mightybyte)
 * [Leonid Onokhov](https://github.com/sopvop)
+* [Alexander Vershilov](https://github.com/qnikst)
diff --git a/changelog.md b/changelog.md
--- a/changelog.md
+++ b/changelog.md
@@ -1,3 +1,7 @@
+0.3.1.3
+=======
+* Fix build on windows
+
 0.3.1.2
 =======
 * Add some missing test files
diff --git a/katip.cabal b/katip.cabal
--- a/katip.cabal
+++ b/katip.cabal
@@ -1,5 +1,5 @@
 name:                katip
-version:             0.3.1.2
+version:             0.3.1.3
 synopsis:            A structured logging framework.
 description:
   Katip is a structured logging framework. See README.md for more details.
@@ -68,7 +68,6 @@
                , time >= 1 && < 1.7
                , transformers >= 0.3 && < 0.6
                , transformers-compat
-               , unix >= 2.5 && < 2.8
                , unordered-containers >= 0.2 && < 0.3
                , monad-control >= 1.0 && < 1.1
                , mtl >= 2.0 && < 2.3
@@ -83,6 +82,12 @@
   ghc-options:        -Wall
   if flag(lib-Werror)
     ghc-options: -Werror
+  if os(windows)
+    build-depends: Win32 >=2.3 && <2.5
+    other-modules: Katip.Compat
+  else
+    build-depends: unix >= 2.5 && <2.8
+
 
 test-suite test
   type: exitcode-stdio-1.0
diff --git a/src/Katip/Compat.hs b/src/Katip/Compat.hs
new file mode 100644
--- /dev/null
+++ b/src/Katip/Compat.hs
@@ -0,0 +1,30 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE CPP #-}
+module Katip.Compat
+  ( ProcessID
+  , getProcessID
+  ) where
+
+import System.Win32.Process
+
+type ProcessID = ProcessId
+
+#if !MIN_VERSION_Win32(2,4,0)
+
+#if defined(i386_HOST_ARCH)
+# define WINDOWS_CCONV stdcall
+#elif defined(x86_64_HOST_ARCH)
+# define WINDOWS_CCONV ccall
+#else
+# error Unknown mingw32 arch
+#endif
+
+foreign import WINDOWS_CCONV unsafe "windows.h GetCurrentProcessId"
+    c_GetCurrentProcessId :: IO ProcessId
+
+getProcessID :: IO ProcessID
+getProcessID = c_GetCurrentProcessId
+#else
+getProcessID :: IO ProcessID
+getProcessID = getCurrentProcessId
+#endif
diff --git a/src/Katip/Core.hs b/src/Katip/Core.hs
--- a/src/Katip/Core.hs
+++ b/src/Katip/Core.hs
@@ -63,7 +63,12 @@
 import           Lens.Micro
 import           Lens.Micro.TH
 import           Network.HostName
+#if mingw32_HOST_OS
+import           Katip.Compat
+#else
 import           System.Posix
+#endif
+
 -------------------------------------------------------------------------------
 
 
diff --git a/test/Katip/Tests/Scribes/Handle.hs b/test/Katip/Tests/Scribes/Handle.hs
--- a/test/Katip/Tests/Scribes/Handle.hs
+++ b/test/Katip/Tests/Scribes/Handle.hs
@@ -7,10 +7,11 @@
 import           Control.Monad
 import           Data.Aeson
 import qualified Data.ByteString.Lazy       as BL
+import qualified Data.ByteString.Char8      as B
 import           Data.Monoid
 import           Data.Text                  (Text)
 import qualified Data.Text                  as T
-import qualified Data.Text.IO               as T
+import qualified Data.Text.Encoding         as T
 import qualified Data.Text.Lazy             as LT
 import qualified Data.Text.Lazy.Builder     as LT
 import           Data.Time
@@ -211,13 +212,14 @@
 -------------------------------------------------------------------------------
 writeTextLog :: (FilePath, Handle) -> IO (BL.ByteString)
 writeTextLog (path, h) = do
-    mapM_ (T.hPutStrLn h . formatOne) genItems
-    mapM_ (T.hPutStrLn h . formatOne) genTypedItems
+    mapM_ (put . formatOne) genItems
+    mapM_ (put . formatOne) genTypedItems
     hClose h
     BL.readFile path
   where
     formatOne :: LogItem a => Item a -> Text
     formatOne = LT.toStrict . LT.toLazyText . formatItem False V3
+    put = B.hPutStrLn h . T.encodeUtf8
 
 setupTempFile :: IO (FilePath, Handle)
 setupTempFile = do
