diff --git a/haskellscript.cabal b/haskellscript.cabal
--- a/haskellscript.cabal
+++ b/haskellscript.cabal
@@ -1,5 +1,5 @@
 name:                   haskellscript
-version:                0.1.2
+version:                0.2.0
 synopsis:               Command line tool for running Haskell scripts with a hashbang.
 description:
   This tool provides the ability to script in a shell with Haskell (including dependencies) the same way that has been possible with bash scripts or Python.
diff --git a/src/HaskellScript.hs b/src/HaskellScript.hs
--- a/src/HaskellScript.hs
+++ b/src/HaskellScript.hs
@@ -89,14 +89,19 @@
   let dependenciesHash = getDependenciesHash scriptDetails
   let scriptHash = getContentHash scriptDetails
   let scriptDir = homeDirectory </> ".haskellscript" </> dependenciesHash
-  scriptDirExists <- lift $ doesDirectoryExist $ scriptDir
-  unless scriptDirExists $ do
+  let dependenciesMarker = scriptDir </> ".dependencieswritten"
+  dependenciesMarkerExists <- lift $ doesFileExist $ dependenciesMarker
+  unless dependenciesMarkerExists $ do
+    -- Remove the directory first.
+    lift $ removeDirectoryRecursive scriptDir
     -- Create hashed path directory.
     lift $ createDirectoryIfMissing True scriptDir
     -- Init sandbox in directory.
     runInWorkingDir scriptDir "cabal" ["sandbox", "init"]
     -- For each dependency install it into the sandbox.
     traverse (\dep -> runInWorkingDir scriptDir "cabal" ["install", (unpack dep)]) (scriptDependencies scriptDetails)
+    -- Write file to confirm dependencies have been written.
+    lift $ TIO.writeFile dependenciesMarker mempty
     return ()
   let scriptLocation = scriptDir </> scriptHash <.> "hs"
   -- Create a file containing the code.
