Which files to backup in .julia?

Hi everyone,

I regularly backup my WSL2 home directory, and I realized that the .julia folder is rather big. Is there any parts of this folder which I can skip ?

Many thanks,
Have a nice day,

P.S: Here the folder size stats:

$ du -sh .julia/* | sort -h
4.0K    .julia/clones
4.0K    .julia/datadeps
80K     .julia/environments
112K    .julia/logs
8.1M    .julia/scratchspaces
9.4M    .julia/registries
631M    .julia/packages
991M    .julia/juliaup
3.0G    .julia/artifacts
7.7G    .julia/compiled
1 Like

I only backup .julia/dev. Because that’s where files reside that I edited. I think of all the other folders in .julia as just caches that Julia can quickly recreate from scratch when you instantiate your projects.

In fact I define the environment variable JULIA_PKG_DEVDIR to point to a location that is backed up, and I point JULIA_DEPOT_PATH and JULIAUP_DEPOT_PATH to a location that is not.

6 Likes

Well, to have a backup of .julia/environments is also a good idea. And a backup of your startup.jl file, if you are using it.

8 Likes

I barely use .julia/environments. I always call julia --project to use it with a local per-project environment.

2 Likes

Many thanks for all your answers. I think I will explicitely exclude the big dirs, but include in my backups all the other stuff.

If you don’t want to erase the whole .julia folder, but still need to clean things up every now and then, use GitHub - giordano/PkgCleanup.jl: Cleanup unused Julia environments and artifacts

I wish Julia itself had a ] cleanup command, and that juliaup erased all artifacts that were built in versions that are no longer installed.

Related: How to cleanup artifacts folder

3 Likes

Not yet but I will definitely have a look on PkgCleanup. Thanks.