Julia takes up a lot of space on my disk - what can be cleaned?

Specifically, in the ~/.julia directory of my home directory, I have these vast collections (as given by ncdu):

4.9 GiB [################] /artifacts                                                                           
3.6 GiB [###########     ] /registries
2.0 GiB [######          ] /packages
1.7 GiB [#####           ] /compiled

Can these be reduced, cleaned, deleted, or somehow rendered smaller? I recently had a “disk full” error, and although I managed to happily prune some system files, there are still these collections I’m not sure about.

(There are a few similar questions here, but all several years old.) I’m using Julia 1.12.5, in Arch Linux, fairly recently upgraded.

Note: I’ve just hunted around online and reduced the artifacts with the PkgCleanup package. The remaining culprit seems to be the directory

.julia/registries/General/.git/objects/pack

which contains lots of large pack files. I don’t know how to deal with these.

Any advice would be greatly welcomed!

2 Likes

You’re looking pretty good there! I get:

image

But more seriously - all of these can safely be deleted, as they will be automatically regenerated. Whether that saves any space depends on whether there’s any stuff in there that you actually don’t need anymore - if you delete artifacts but are actually using packages relying on those artifacts, they will be downloaded again.

registries looks quite big to me, do you maybe have the full git history in there? I get by with 0.5GB for that.

3 Likes

This likely means you are still using a git clone of the General registry, which will generally also be slower to update. You can try running

import Pkg; Pkg.Registry.rm("General"); Pkg.Registry.add("General")

which will reinstall the General registry and should use a more efficient format via the package server, and see if that fixes the issue.

4 Likes

If your filesystem supports it (eg BTRFS, ZFS), it makes sense to enable on-the-fly compression.

Eg artifacts compress to about 20% with zstd defaults.

4 Likes