JuliaLang/juliaup

`juliaup gc` should remove `compiled` and `environments` folders that are no longer needed

Opened this issue · 7 comments

I had Julia release 1.10.5 and beta 1.11rc3 both installed using Juliaup. I used juliaup remove release to remove the 1.10.5 installation, and then afterwards, used juliaup gc. To my surprise, the .julia/compiled/v1.10/ and .julia/environments/v1.10/ folders remained, which is significant because the first one was using 700MB of storage. I would've expected them to be deleted since they're no longer needed.

It would be great if juliaup gc could detect when such folders are no longer needed and remove them accordingly. Thank you!

(If it helps: Juliaup 1.17.4, macOS 14.6.1)

My gut feeling is that we can/should do something about the .julia/compiled folder, but not .julia/environments. The compiled folder is really just a cache/optimization, so deleting that seems fine. But the environments folder is really user-controlled/created data, and I think we should just never delete anything there.

Should imo be a part of Pkg.gc since that already handles artifacts and packages.

But Pkg.gc presumably doesn't know which Julia versions are installed, right?

Yeah - I assume a Pkg in one Julia installation wouldn't know what other Julia installations you have, so it would need to be managed by juliaup.

Could potentially be a two-step thing where juliaup gc writes a file that marks something as potentially unused and then Pkg.gc uses that to figure out what can be deleted. But seems kind of slow to kick in then...

We could also add a secret command to juliaup that Pkg.jl could use to get a list of all currently installed Julia versions. Pkg.gc could try to spawn that command then, and if it gets something useful back use that information to decide which folders to delete.

I think in general we are probably reaching a point where Juliaup and Pkg.jl should be more integrated and talk to each other.

I think in general we are probably reaching a point where Juliaup and Pkg.jl should be more integrated and talk to each other.

Yes, it does seem like we're at that point.