stack-clean-old: Clean away old stack build artefacts

[ bsd3, distribution, program ] [ Propose Tags ]

A tool for cleaning away old stack snapshots and stack-work builds to recover diskspace.

[Skip to Readme]


Maintainer's Corner

For package maintainers and hackage trustees


Versions [RSS] 0.1, 0.2, 0.2.1, 0.2.2, 0.3, 0.3.1, 0.4, 0.4.1, 0.4.2, 0.4.3, 0.4.4, 0.4.5, 0.4.6
Change log
Dependencies base (<5), directory, extra, filepath, simple-cmd (>=0.1.4), simple-cmd-args (>=0.1.2) [details]
License BSD-3-Clause
Copyright 2020 Jens Petersen <>
Author Jens Petersen <>
Maintainer Jens Petersen <>
Category Distribution
Home page
Bug tracker
Source repo head: git clone
Uploaded by JensPetersen at 2020-09-22T09:59:36Z
Distributions LTSHaskell:0.4.6, NixOS:0.4.6, Stackage:0.4.6
Executables stack-clean-old
Downloads 1259 total (7 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs not available [build log]
Last success reported on 2020-09-22 [all 2 reports]

Readme for stack-clean-old-0.1

[back to package description]


A small tool to clean away older Haskell stack snapshot builds and ghc versions, to recover diskspace.


stack-clean-old [project|snapshots|ghc] [size|list|remove-version] [GHCVER]

These commands act respectively on:

  • the current local project (.stack-work/install/)
  • the user's stack snapshot builds (~/.stack/snapshots/)
  • installed stack ghc compilers (~/.stack/programs/).

size: prints the total size of the above directory (size does not take a GHCVER argument).

list: shows the total size and number of snapshots per ghc version (the GHCVER argument is optional).

remove-version: removes all snapshots for the specified ghc version (the GHCVER argument is required).

NB: If you remove all snapshot builds for a version of ghc, then you would have to rebuild again for any projects still using them, so removal should be used cautiously, but it can recover a lot of diskspace.

Purging older stack project builds

stack-clean-old project remove-older

This command removes older stack builds from .stack-work/install/. By default it keeps 5 newest builds per ghc version.

The preservation/deletion is calculated and done per ghc version.

NB: If you regularly build multiple branches/tags against the same LTS or ghc version then it is probably safer to avoid using remove-older.


Run stack install or cabal install


BSD license


Warning disclaimer

Use at your own risk.

The author takes no responsibility for any loss or damaged caused by using this tool. Bug reports, suggestions, and improvements are welcome.