diff --git a/Distribution/Cab/Commands.hs b/Distribution/Cab/Commands.hs
--- a/Distribution/Cab/Commands.hs
+++ b/Distribution/Cab/Commands.hs
@@ -5,6 +5,7 @@
   , genpaths, check, initSandbox, add, ghci
   ) where
 
+import qualified Control.Exception as E
 import Control.Monad (forM_, unless, when, void)
 import Data.Char (toLower)
 import Data.List (intercalate, isPrefixOf)
@@ -42,6 +43,7 @@
             | OptFuture
             | OptDebug
             | OptAllowNewer
+            | OptCleanUp
             deriving (Eq,Show)
 
 ----------------------------------------------------------------
@@ -77,12 +79,17 @@
 outdated _ opts _ = do
     pkgs <- toPkgInfos <$> getDB opts
     verDB <- toMap <$> getVerDB InstalledOnly
+    let del = OptCleanUp `elem` opts
     forM_ pkgs $ \p -> case M.lookup (nameOfPkgInfo p) verDB of
         Nothing  -> return ()
         Just ver -> do
             let comp = verOfPkgInfo p `compare` ver
-            when (dated comp) $
-                putStrLn $ fullNameOfPkgInfo p ++ (showIneq comp) ++ verToString ver
+            when (dated comp) $ do
+                if del then do
+                    let (nm,vr) = pairNameOfPkgInfo p
+                    uninstall [nm,vr] [OptRecursive] [] `E.catch` \(E.SomeException _) -> return ()
+                  else
+                    putStrLn $ fullNameOfPkgInfo p ++ showIneq comp ++ verToString ver
   where
     dated LT = True
     dated GT = OptFuture `elem` opts
diff --git a/Distribution/Cab/Sandbox.hs b/Distribution/Cab/Sandbox.hs
--- a/Distribution/Cab/Sandbox.hs
+++ b/Distribution/Cab/Sandbox.hs
@@ -94,6 +94,6 @@
   where
     file = takeFileName dir
     findVer = drop 4 . head . filter ("ghc-" `isPrefixOf`) . tails
-    (verStr1,_:left) = break (== '.') $ findVer file
-    (verStr2,_)      = break (== '.') left
+    (verStr1,left) = break (== '.') $ findVer file
+    (verStr2,_)    = break (== '.') $ tail left
     ver = read verStr1 * 100 + read verStr2
diff --git a/cab.cabal b/cab.cabal
--- a/cab.cabal
+++ b/cab.cabal
@@ -1,5 +1,5 @@
 Name:                   cab
-Version:                0.2.20
+Version:                0.2.21
 Author:                 Kazu Yamamoto <kazu@iij.ad.jp>
 Maintainer:             Kazu Yamamoto <kazu@iij.ad.jp>
 License:                BSD3
diff --git a/src/Commands.hs b/src/Commands.hs
--- a/src/Commands.hs
+++ b/src/Commands.hs
@@ -95,6 +95,7 @@
        , routing = RouteFunc outdated
        , switches = [(SwAll, None)
                     ,(SwFuture, Solo "--future")
+                    ,(SwCleanUp, None)
                     ]
        , manual = Nothing
        }
@@ -221,6 +222,14 @@
        , commandNames = ["init"]
        , document = "Initialize a sandbox"
        , routing = RouteFunc initSandbox
+       , switches = []
+       , manual = Nothing
+       }
+  , CommandSpec {
+         command = DocTest
+       , commandNames = ["doctest"]
+       , document = "Run doctest"
+       , routing = RouteCabal ["v1-repl", "--with-ghc=doctest"]
        , switches = []
        , manual = Nothing
        }
diff --git a/src/Options.hs b/src/Options.hs
--- a/src/Options.hs
+++ b/src/Options.hs
@@ -57,10 +57,13 @@
   , Option ['x'] ["newer"]
        (NoArg OptAllowNewer)
       "Allow newer versions"
+  , Option ['c'] ["cleanup"]
+       (NoArg OptCleanUp)
+      "Remove outdated packages"
   , Option ['h'] ["help"]
       (NoArg OptHelp)
       "Show help message"
   ]
 
 optionDB :: OptionDB
-optionDB = zip [SwNoharm,SwRecursive,SwAll,SwInfo,SwFlag,SwTest,SwBench,SwDepsOnly,SwLibProfile,SwExecProfile,SwDebug,SwJobs,SwImport,SwStatic,SwFuture,SwAllowNewer] getOptDB
+optionDB = zip [SwNoharm,SwRecursive,SwAll,SwInfo,SwFlag,SwTest,SwBench,SwDepsOnly,SwLibProfile,SwExecProfile,SwDebug,SwJobs,SwImport,SwStatic,SwFuture,SwAllowNewer,SwCleanUp] getOptDB
diff --git a/src/Run.hs b/src/Run.hs
--- a/src/Run.hs
+++ b/src/Run.hs
@@ -31,6 +31,7 @@
 toSwitch OptStatic      = SwStatic
 toSwitch OptFuture      = SwFuture
 toSwitch OptAllowNewer  = SwAllowNewer
+toSwitch OptCleanUp     = SwCleanUp
 toSwitch _              = error "toSwitch"
 
 ----------------------------------------------------------------
diff --git a/src/Types.hs b/src/Types.hs
--- a/src/Types.hs
+++ b/src/Types.hs
@@ -25,6 +25,7 @@
             | SwStatic
             | SwFuture
             | SwAllowNewer
+            | SwCleanUp
             deriving (Eq,Show)
 
 ----------------------------------------------------------------
@@ -65,6 +66,7 @@
              | Bench
              | Doc
              | Init
+             | DocTest
              | Help
              deriving (Eq,Show)
 
