# Which files or subdirectories in \`~/.julia/\` can I delete?

**URL:** <https://discourse.julialang.org/t/which-files-or-subdirectories-in-julia-can-i-delete/62230>\
**Category:** General Usage\
**Tags:** question\
**Created:** [June 1, 2021, 9:06pm UTC](https://discourse.julialang.org/t/which-files-or-subdirectories-in-julia-can-i-delete/62230 "2021-06-01T21:06:26Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![biona001](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/biona001/32/16497_2.png) [@biona001](https://discourse.julialang.org/u/biona001)\
**Post date:** [June 1, 2021, 9:06pm UTC](https://discourse.julialang.org/t/which-files-or-subdirectories-in-julia-can-i-delete/62230/1 "2021-06-01T21:06:26Z")

</div>

I am running Julia 1.5.4 on a HPC cluster, which has a strict 200,000 file count per user.

`~/.julia` consumes \>75% of this quota:

```julia
$ du -a | cut -d/ -f2 | sort | uniq -c | sort -nr
 153692 .julia
  19159 .conda
  10007 NFBC_chr21_sim
   1559 .local
    187 .cache
...

```

Insider `~/.julia`, the breakdown looks like

```julia
$ du -a | cut -d/ -f2 | sort | uniq -c | sort -nr
  51947 conda
  45479 packages
  28661 registries
  23839 artifacts
   1945 clones
   1570 compiled
    217 dev
     16 environments
      9 lib
      4 prefs
      4 logs

```

[This thread](https://discourse.julialang.org/t/how-to-reduce-the-large-number-of-files-in-julia/38087) suggested to delete `clones` which doesn’t help much.

Anything else I can do? Can I delete `conda` or `registries`? What about `~/.conda`?

---

<div class="post-metadata">

**Author:** ![jzr](https://avatars.discourse-cdn.com/v4/letter/j/eb9ed0/32.png) [@jzr](https://discourse.julialang.org/u/jzr)\
**Post date:** [June 1, 2021, 9:17pm UTC](https://discourse.julialang.org/t/which-files-or-subdirectories-in-julia-can-i-delete/62230/2 "2021-06-01T21:17:13Z")

</div>

I have ~/.julia/conda but it’s nearly empty and I don’t know how it even got there. Might move it out of the way and see if anything breaks.

I think `/registries` is needed for installing julia packages, though you could delete it and re-add it later if you are really stuck. `/clones` will accumulate over time but probably isn’t necessary.

Anything labeled “cache” here can be deleted and rebuilt as needed, it just might take some time to rebuild them. [Store settings and packages in XDG directories instead of ~/.julia · Issue #4630 · JuliaLang/julia · GitHub](https://github.com/JuliaLang/julia/issues/4630#issuecomment-761265058)

---

<div class="post-metadata">

**Author:** ![js135005](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/js135005/32/8219_2.png) [@js135005](https://discourse.julialang.org/u/js135005)\
**Post date:** [June 1, 2021, 9:38pm UTC](https://discourse.julialang.org/t/which-files-or-subdirectories-in-julia-can-i-delete/62230/3 "2021-06-01T21:38:33Z")

</div>

The other thing that may help a little is to use the package manager’s gc command to clear out some files/packages no longer needed.

E.g.  
`(@v1.6) pkg> gc`

---

<div class="post-metadata">

**Author:** ![tbeason](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tbeason/32/15898_2.png) [@tbeason](https://discourse.julialang.org/u/tbeason)\
**Post date:** [June 1, 2021, 10:58pm UTC](https://discourse.julialang.org/t/which-files-or-subdirectories-in-julia-can-i-delete/62230/4 "2021-06-01T22:58:09Z")

</div>

I have a related question about artifacts. My artifacts folder is 20GB. I have no doubt that some of those are probably from packages I installed to try out once and haven’t used since. Is it possible to do some sort of purge there without repercussions? I did run `] gc` and it deleted only a trivial amount.

---

<div class="post-metadata">

**Author:** ![jzr](https://avatars.discourse-cdn.com/v4/letter/j/eb9ed0/32.png) [@jzr](https://discourse.julialang.org/u/jzr)\
**Post date:** [June 1, 2021, 11:00pm UTC](https://discourse.julialang.org/t/which-files-or-subdirectories-in-julia-can-i-delete/62230/5 "2021-06-01T23:00:39Z")

</div>

Stefan’s answer in the linked thread is that they can be deleted and rebuilt.

---

<div class="post-metadata">

**Author:** ![tbeason](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tbeason/32/15898_2.png) [@tbeason](https://discourse.julialang.org/u/tbeason)\
**Post date:** [June 1, 2021, 11:06pm UTC](https://discourse.julialang.org/t/which-files-or-subdirectories-in-julia-can-i-delete/62230/6 "2021-06-01T23:06:05Z")

</div>

Ah ok I misread your post! I thought “cache” was referring to a folder. I will give that a shot.

---

<div class="post-metadata">

**Author:** ![marius311](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/marius311/32/3953_2.png) [@marius311](https://discourse.julialang.org/u/marius311)\
**Post date:** [June 1, 2021, 11:17pm UTC](https://discourse.julialang.org/t/which-files-or-subdirectories-in-julia-can-i-delete/62230/7 "2021-06-01T23:17:26Z")

</div>

If your cluster has a scratch filesystem with a larger quota, you can also put `~/.julia` there instead by setting `JULIA_DEPOT_PATH` appropriately.

---

<div class="post-metadata">

**Author:** ![dilumaluthge](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dilumaluthge/32/29283_2.png) [@dilumaluthge](https://discourse.julialang.org/u/dilumaluthge)\
**Post date:** [June 1, 2021, 11:26pm UTC](https://discourse.julialang.org/t/which-files-or-subdirectories-in-julia-can-i-delete/62230/8 "2021-06-01T23:26:04Z")

</div>

> [@tbeason](#):
>
> I did run `] gc` and it deleted only a trivial amount.

If you want a more thorough garbage collection, you can do `] gc --all`

---

<div class="post-metadata">

**Author:** ![tbeason](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tbeason/32/15898_2.png) [@tbeason](https://discourse.julialang.org/u/tbeason)\
**Post date:** [June 1, 2021, 11:28pm UTC](https://discourse.julialang.org/t/which-files-or-subdirectories-in-julia-can-i-delete/62230/9 "2021-06-01T23:28:42Z")

</div>

Yea… not exactly a real killer is it?

```julia
(UCARMAModels) pkg> gc --all
      Active manifest files: 44 found
      Active artifact files: 168 found
      Active scratchspaces: 7 found
     Deleted 39 package installations (40.117 MiB)
     Deleted 1 artifact installation (6.348 MiB)

```

---

<div class="post-metadata">

**Author:** ![dilumaluthge](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dilumaluthge/32/29283_2.png) [@dilumaluthge](https://discourse.julialang.org/u/dilumaluthge)\
**Post date:** [June 1, 2021, 11:30pm UTC](https://discourse.julialang.org/t/which-files-or-subdirectories-in-julia-can-i-delete/62230/10 "2021-06-01T23:30:34Z")

</div>

Oof. That is disappointing. I guess the artifacts that didn’t get GC’d must correspond to packages that you actually still have installed in some environment. If you uninstall those packages and then do `gc --all`, it should remove the artifacts.

I agree that the results you got are kind of underwhelming.

---

<div class="post-metadata">

**Author:** ![tbeason](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tbeason/32/15898_2.png) [@tbeason](https://discourse.julialang.org/u/tbeason)\
**Post date:** [June 1, 2021, 11:32pm UTC](https://discourse.julialang.org/t/which-files-or-subdirectories-in-julia-can-i-delete/62230/11 "2021-06-01T23:32:32Z")

</div>

To be fair, I had already run a regular `gc` not all that long ago. Maybe 2 weeks? But it didn’t do much better than that. I agree that the packages are likely hidden in Project.toml files, but I wonder if some sort of expiration date could be set?

---

<div class="post-metadata">

**Author:** ![carstenbauer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/carstenbauer/32/4981_2.png) [@carstenbauer](https://discourse.julialang.org/u/carstenbauer)\
**Post date:** [June 2, 2021, 7:06am UTC](https://discourse.julialang.org/t/which-files-or-subdirectories-in-julia-can-i-delete/62230/12 "2021-06-02T07:06:33Z")

</div>

For a start it would be great if there were commands for listing all the “tracked” environments and for “untracking” (some of) them. These features [have been discussed ~2 years ago](https://github.com/JuliaLang/Pkg.jl/issues/621) but have never been implemented (please correct me if I’m wrong).

(@tbeason Note that you have 44 Manifests and I bet that you don’t care about some / many of them anymore.)

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [June 2, 2021, 9:25am UTC](https://discourse.julialang.org/t/which-files-or-subdirectories-in-julia-can-i-delete/62230/13 "2021-06-02T09:25:24Z")

</div>

You can pass `--verbose` to `gc` to see the manifests that are being “tracked”.

---

<div class="post-metadata">

**Author:** ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)\
**Post date:** [June 2, 2021, 9:48am UTC](https://discourse.julialang.org/t/which-files-or-subdirectories-in-julia-can-i-delete/62230/14 "2021-06-02T09:48:26Z")

</div>

I once quickly wrote a small package to make it easier to clean up environments: [`PkgCleanup.jl`](https://github.com/giordano/PkgCleanup.jl). Not very thoroughly developed though

---

<div class="post-metadata">

**Author:** ![heliosdrm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/heliosdrm/32/3851_2.png) [@heliosdrm](https://discourse.julialang.org/u/heliosdrm)\
**Post date:** [June 2, 2021, 10:51am UTC](https://discourse.julialang.org/t/which-files-or-subdirectories-in-julia-can-i-delete/62230/15 "2021-06-02T10:51:49Z")

</div>

Last time I wanted to purge my filesystem from unused packages I had the same problem: many environments tracked, which I didn’t really want. Manually editing `.julia/logs/manifest_usage.toml` helped `]gc` to be more efficient.

---

<div class="post-metadata">

**Author:** ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)\
**Post date:** [June 2, 2021, 10:52am UTC](https://discourse.julialang.org/t/which-files-or-subdirectories-in-julia-can-i-delete/62230/16 "2021-06-02T10:52:48Z")

</div>

Which is what `PkgCleanup.jl` helps doing

---

<div class="post-metadata">

**Author:** ![joa-quim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joa-quim/32/227_2.png) [@joa-quim](https://discourse.julialang.org/u/joa-quim)\
**Post date:** [June 2, 2021, 12:06pm UTC](https://discourse.julialang.org/t/which-files-or-subdirectories-in-julia-can-i-delete/62230/17 "2021-06-02T12:06:03Z")

</div>

The `artifacts` is full of unneeded files. In almost all cases only the shared lib file is needed but it comes with `include, .exe, logs, *.a or *.lib, ,gz` etc.  
They should only come with the needed files.

---

<div class="post-metadata">

**Author:** ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)\
**Post date:** [June 2, 2021, 12:24pm UTC](https://discourse.julialang.org/t/which-files-or-subdirectories-in-julia-can-i-delete/62230/18 "2021-06-02T12:24:26Z")

</div>

> [@joa-quim](#):
>
> They should only come with the needed files.

I take you’re volunteering to help?

---

<div class="post-metadata">

**Author:** ![tbeason](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tbeason/32/15898_2.png) [@tbeason](https://discourse.julialang.org/u/tbeason)\
**Post date:** [June 2, 2021, 3:33pm UTC](https://discourse.julialang.org/t/which-files-or-subdirectories-in-julia-can-i-delete/62230/19 "2021-06-02T15:33:22Z")

</div>

Thanks! This looks really helpful but…isn’t working for me? I have tried multiple times now but it never seems to remove anything from the active manifests list. In fact even if I select `n=none` it doesn’t remove any. I will edit manually.

---

<div class="post-metadata">

**Author:** ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)\
**Post date:** [June 2, 2021, 3:47pm UTC](https://discourse.julialang.org/t/which-files-or-subdirectories-in-julia-can-i-delete/62230/20 "2021-06-02T15:47:54Z")

</div>

Mind opening an issue with more details?

I didn’t claim that package is battle-tested, that’s like the result of a couple of hours of coding out of frustration one night, never touched it again since then.

[Next page](https://discourse.julialang.org/t/which-files-or-subdirectories-in-julia-can-i-delete/62230.md?page=2)
