How to Uninstall Installed Crates

What it says on the tin. Crates can be installed with alr install, but I can’t seem to find any way to uninstall them. The binaries can be deleted, but Alire does some internal bookkeeping and believes that they are still installed.

Hi @nekodjin!

First things first, welcome to the forums ^^

I took a look at the docs and Alire does support uninstalling toolchains… But looking a bit deeper, in the alr install section it says:

At present, only binary releases can be installed (e.g., compilers, gprbuild, gnatprove). There is no ability to uninstall releases either (but reinstallation can be forced).

So… I am even surprised myself, but it does not seem to support uninstalling crates via alr install… I will se if this has already been reported in the Alire repository and if not, make an issue.

Best,
Fer


Edit: there does not seem to be an open issue regarding uninstalling. I will open one now.
Edit 2: opened issue here

1 Like

I wonder if removing the cache directory would work but that might remove more than you would like.

Given that Alire uses gprinstall, maybe there’s a way to call gprinstall --uninstall to do the job, like alr exec -P1 -- gprinstall --uninstall --prefix=~/.alire/. But I guess that, if it were so easy, Alire would have already implemented it.

Indeed, the cause of unavailability of --uninstall is that installation for crates from sources and from binaries is different, with the latter not using gprinstall.

It’s a matter of time, but time is scarce, alas…

The trick to make Alire forget that something is installed is to remove the <prefix>/share/gpr/manifests/<crate>=<version> file.

1 Like