How to cleanup artifacts folder

I recently noticed that my home folder is occupying 89% of my SSD because of .julia/artifacts:

How to clean up this folder and start fresh? I just want to keep the global environments I’ve defined and the dev’ed packages in .julia/dev. I would like to erase everything else that is precompiled as cache, binary, lib, etc.

Is there a Pkg.reset() command that I could use to clean all these things up?

2 Likes
3 Likes

I followed the instructions in the PkgCleanup.jl README, the two commands:

using Pkg
using PkgCleanup
using Dates

PkgCleanup.manifests()
PkgCleanup.artifacts()

Pkg.gc(; collect_delay=Dates.Day(0))

They saved a lot of space already, but now I want to erase the contents of the compiled subfolder with old Julia versions:

Can I safely remove these folders by hand?

1 Like

Depends on what you mean by “safely”: compiled contains autogenerated files which will be automatically regenerated on demand, so it can probably be considered “safe”, but you’ll have to recompile a lot of stuff the first time you use a package again.

Yes, I want a fresh installation. Deleting anything that is not source code and that is not related to the latest Julia version, in this case Julia v1.9.

Maybe PkgCleanup.jl could provide a single command that does this “fresh installation” deleting all kinds of binaries and retaining only source code of package in the dev folder?

2 Likes

Please let us know the progress of this. I am interested in doing a clean up as well.
Thanks for sharing.

1 Like

@giordano I had to manually delete the compiled subfolders for old Julia versions again after running PkgCleanup.jl. I can’t find a good reason to preserve compiled files for old versions of the language that are no longer installed.

Could this step be included in the default PkgCleanup.jl command from the README?

As a side note, it would be great if juliaup had a cleanup command to erase all files from versions that are no longer installed.

1 Like