Search code examples
haskellcabal-install

How to uninstall a hackage built by myself with cabal?


i use cabal build and cabal install to install a hackage for a test

executable test-hackage
    main-is:          Main.hs

    -- Modules included in this executable, other than Main.
    -- other-modules:

    -- LANGUAGE extensions used by modules in this package.
    -- other-extensions:
    build-depends:    base ^>=4.16.4.0
    hs-source-dirs:   app
    default-language: Haskell2010

how can i uninstall it?

uninstall remove can not be used


Solution

  • The default behaviour of cabal install is to install the executable to cabal's package store and create a symlink to it in the destination directory (which, in Linux, defaults to ~/.cabal/bin). If you just want to remove the executable from your path, deleting the symlink is enough.

    cabal currently doesn't have a uninstall command. If there's a need to reclaim disk space, the most straightforward way to do so is deleting the store. Here is what the User's Guide has to say on the matter:

    The global package store is ~/.cabal/store (configurable via global store-dir option); if you need to clear your store for whatever reason (e.g., to reclaim disk space or because the global store is corrupted), deleting this directory is safe (v2-build will just rebuild everything it needs on its next invocation).