Prune "compiled" folder

Is there a way to prune the .julia/compiled folder? It is getting quite big.

The most conservative thing would likely be to do using Pkg; Pkg.gc() and see how much that removes.

But you You can just rm -rf .julia/compiled (or more specific subdirectories in there) if you want. When you load packages, julia will start over recompiling them and re-create the .julia/compiled folder as needed.

I do this every once in a while if I end up with a bunch of compiled code I don’t want.

2 Likes

Especially there is folders for each version of Julia:

(base) felix@saturn:~/.julia/compiled$ ls
v1.10  v1.11  v1.8  v1.9

Deleting v1.8 and v1.9 is fine if you don’t use the older versions anymore.

5 Likes

For some packages, I see multiple DLLs and .ji files. For instance, I have four Makie DLLs each with 130 MB. Is it safe to delete the old ones?

It is always safe to deleted anything in .compiled it’s a pure on disk cache and Julia will recreate it if necessary

3 Likes

Is there a core mechanism that gets rid of unused stuff or will .julia grow indefinitely?

Pkg will run garbage collection every now and then but .julia does somewhat have a tendency to grow indefinitely.

I think users tend to gripe a lot more about unexpected recompilation of stuff they’ve used before than about an extra 5GB of hard drive space used, so it’s probably best to be somewhat conservative in what to prune.

1 Like

It is 70 GB in my case.

4 Likes

That’s rather impressive. Do you by chance have a lot of julia versions in there?

1 Like