# Prune "compiled" folder

**URL:** <https://discourse.julialang.org/t/prune-compiled-folder/109567>\
**Category:** General Usage\
**Created:** [February 1, 2024, 12:10pm UTC](https://discourse.julialang.org/t/prune-compiled-folder/109567 "2024-02-01T12:10:09Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![ohmsweetohm1](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ohmsweetohm1/32/49126_2.png) [@ohmsweetohm1](https://discourse.julialang.org/u/ohmsweetohm1)\
**Post date:** [February 1, 2024, 12:10pm UTC](https://discourse.julialang.org/t/prune-compiled-folder/109567/1 "2024-02-01T12:10:10Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Mason](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mason/32/2423_2.png) [@Mason](https://discourse.julialang.org/u/Mason)\
**Post date:** [February 1, 2024, 12:37pm UTC](https://discourse.julialang.org/t/prune-compiled-folder/109567/2 "2024-02-01T12:37:38Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![roflmaostc](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/roflmaostc/32/30123_2.png) [@roflmaostc](https://discourse.julialang.org/u/roflmaostc)\
**Post date:** [February 1, 2024, 12:52pm UTC](https://discourse.julialang.org/t/prune-compiled-folder/109567/3 "2024-02-01T12:52:07Z")

</div>

Especially there is folders for each version of Julia:

```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.

---

<div class="post-metadata">

**Author:** ![ohmsweetohm1](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ohmsweetohm1/32/49126_2.png) [@ohmsweetohm1](https://discourse.julialang.org/u/ohmsweetohm1)\
**Post date:** [February 1, 2024, 1:08pm UTC](https://discourse.julialang.org/t/prune-compiled-folder/109567/4 "2024-02-01T13:08:02Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![vchuravy](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vchuravy/32/8_2.png) [@vchuravy](https://discourse.julialang.org/u/vchuravy)\
**Post date:** [February 1, 2024, 6:41pm UTC](https://discourse.julialang.org/t/prune-compiled-folder/109567/5 "2024-02-01T18:41:52Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ohmsweetohm1](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ohmsweetohm1/32/49126_2.png) [@ohmsweetohm1](https://discourse.julialang.org/u/ohmsweetohm1)\
**Post date:** [February 5, 2024, 4:52pm UTC](https://discourse.julialang.org/t/prune-compiled-folder/109567/6 "2024-02-05T16:52:19Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Oscar\_Smith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oscar_smith/32/25343_2.png) [@Oscar\_Smith](https://discourse.julialang.org/u/Oscar_Smith)\
**Post date:** [February 5, 2024, 4:56pm UTC](https://discourse.julialang.org/t/prune-compiled-folder/109567/7 "2024-02-05T16:56:40Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)\
**Post date:** [February 5, 2024, 6:12pm UTC](https://discourse.julialang.org/t/prune-compiled-folder/109567/8 "2024-02-05T18:12:56Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ohmsweetohm1](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ohmsweetohm1/32/49126_2.png) [@ohmsweetohm1](https://discourse.julialang.org/u/ohmsweetohm1)\
**Post date:** [February 5, 2024, 7:12pm UTC](https://discourse.julialang.org/t/prune-compiled-folder/109567/9 "2024-02-05T19:12:51Z")

</div>

It is 70 GB in my case.

---

<div class="post-metadata">

**Author:** ![Oscar\_Smith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oscar_smith/32/25343_2.png) [@Oscar\_Smith](https://discourse.julialang.org/u/Oscar_Smith)\
**Post date:** [February 5, 2024, 7:53pm UTC](https://discourse.julialang.org/t/prune-compiled-folder/109567/10 "2024-02-05T19:53:24Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Balinus](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/balinus/32/243_2.png) [@Balinus](https://discourse.julialang.org/u/Balinus)\
**Post date:** [April 3, 2025, 7:45pm UTC](https://discourse.julialang.org/t/prune-compiled-folder/109567/11 "2025-04-03T19:45:19Z")

</div>

I had about 50GB in my home folder on our HPC which has limited user-space. Thankfully, it was simply a matter of deleting compiled folders for version \< 1.11.

Is there other folders that can be deleted safely? (I have another HPC with even more limited home space, about 6GB)

---

<div class="post-metadata">

**Author:** ![ohmsweetohm1](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ohmsweetohm1/32/49126_2.png) [@ohmsweetohm1](https://discourse.julialang.org/u/ohmsweetohm1)\
**Post date:** [April 10, 2025, 6:20pm UTC](https://discourse.julialang.org/t/prune-compiled-folder/109567/12 "2025-04-10T18:20:01Z")

</div>

I have a cron job that `rm -rf` the `.julia` folder and reinstalls my registries.

---

<div class="post-metadata">

**Author:** ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)\
**Post date:** [April 10, 2025, 11:48pm UTC](https://discourse.julialang.org/t/prune-compiled-folder/109567/13 "2025-04-10T23:48:50Z")

</div>

I would not recommend deleting the entire `.julia` folder since there are some items in there that you may not want to delete and which are also quite small. For example:

1. The default version specific environments in `.julia/environments`
2. Your REPL command history in `.julia/logs`
3. Packages that you may have `dev`ed and edited in `.julia/dev`
4. Configuration such as your startup.jl in `.julia/config`
5. Pluto notebooks in `.julia/pluto_notebooks`

I would consider clearing out the following, especially if you have used Julia for a long time:

1. `.julia/compiled` (will be automatically recompiled)
2. `.julia/artifacts` (artifacts that have not been used in a while can be removed)
3. `.julia/scratchspaces` (these should be transient and be reinstalled)
4. `.julia/packages` (can be reinstalled via `Pkg.instantiate()`)

`Pkg.gc()` does better than in the past for recent installations. There is also `juliaup gc` if you are a `juliaup` user. You may also want to look at [GitHub - giordano/PkgCleanup.jl: Cleanup unused Julia environments and artifacts](https://github.com/giordano/PkgCleanup.jl) .

---

<div class="post-metadata">

**Author:** ![ohmsweetohm1](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ohmsweetohm1/32/49126_2.png) [@ohmsweetohm1](https://discourse.julialang.org/u/ohmsweetohm1)\
**Post date:** [April 12, 2025, 1:57pm UTC](https://discourse.julialang.org/t/prune-compiled-folder/109567/14 "2025-04-12T13:57:45Z")

</div>

Why is there no mechanism in Julia to remove the old version of a package if I have updated it? At least an option. I know there is no ONE version, it soly depends on the environments I am using. But having 50 GB of “stale” stuff is not acceptable.

I have to say even though in Python package management is really poor (it got a lot better with `uv`) but at least with virtual environments you do not have this problem. The code is simply right there. And there is no point in having any other packages or old version in that `.venv`.  
I guess having it locally per environment has its charme.

---

<div class="post-metadata">

**Author:** ![Benny](https://avatars.discourse-cdn.com/v4/letter/b/49beb7/32.png) [@Benny](https://discourse.julialang.org/u/Benny)\
**Post date:** [April 12, 2025, 11:39pm UTC](https://discourse.julialang.org/t/prune-compiled-folder/109567/15 "2025-04-12T23:39:32Z")

</div>

> [@ohmsweetohm1](#):
>
> Why is there no mechanism in Julia to remove the old version of a package if I have updated it?

You mean directly? Because it’s unsafe. Say you remove SomePackage v0.3.5 today because your environments for the last year all use v0.4+, but next month you need to reproduce some old script from a few years ago. So you blow the dust off and `activate` that environment, but everything’s broken for some reason you can’t remember and `activate` cannot tell, so you manually `instantiate`.

> [@ohmsweetohm1](#):
>
> I guess having it locally per environment has its charme.

The cost of lightweight environments depending on systemic installation is management has to be systemic and opinionated. It might’ve been a reasonable choice to only track recently `activate`-d environments and expect us to `instantiate` the others, but somebody decided not to surprise us like that, so we have the responsibility of getting rid of manifests so `Pkg.gc` can do its work. Last time I checked (well, eyeballed), `gc` only seems to modify `/packages` and `/artifacts`, not `/compiled`. I don’t expect it to be controversial for `gc` to handle that too, but for all I know, maybe someone decided that it’d be better to keep those around to keep precompilation times down. More clarity and options would indeed be nice.

---

<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:** [April 13, 2025, 12:41am UTC](https://discourse.julialang.org/t/prune-compiled-folder/109567/16 "2025-04-13T00:41:43Z")

</div>

> [@ohmsweetohm1](#):
>
> Why is there no mechanism in Julia to remove the old version of a package if I have updated it?

`Pkg.gc` (already mentioned above) does literally that, as long as there’s no active manifest keeping an older version necessary.

---

<div class="post-metadata">

**Author:** ![ohmsweetohm1](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ohmsweetohm1/32/49126_2.png) [@ohmsweetohm1](https://discourse.julialang.org/u/ohmsweetohm1)\
**Post date:** [April 13, 2025, 6:18am UTC](https://discourse.julialang.org/t/prune-compiled-folder/109567/17 "2025-04-13T06:18:05Z")

</div>

What is “active” manifest? How would I deactivate it?

---

<div class="post-metadata">

**Author:** ![ohmsweetohm1](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ohmsweetohm1/32/49126_2.png) [@ohmsweetohm1](https://discourse.julialang.org/u/ohmsweetohm1)\
**Post date:** [April 13, 2025, 6:26am UTC](https://discourse.julialang.org/t/prune-compiled-folder/109567/18 "2025-04-13T06:26:05Z")

</div>

> [@Benny](#):
>
> , but next month you need to reproduce some old script from a few years ago.

I would not expect that to work, without any hassle. In the meantime I probably have updated Julia.

---

<div class="post-metadata">

**Author:** ![Benny](https://avatars.discourse-cdn.com/v4/letter/b/49beb7/32.png) [@Benny](https://discourse.julialang.org/u/Benny)\
**Post date:** [April 13, 2025, 8:43am UTC](https://discourse.julialang.org/t/prune-compiled-folder/109567/19 "2025-04-13T08:43:24Z")

</div>

> [@ohmsweetohm1](#):
>
> What is “active” manifest?

I don’t know where it’s internally stored, but `Pkg` keeps track of the paths to the manifests of all the environments you’ve ever activated. `Pkg.gc` determines what dependencies to keep by going through all these manifests, analogous to garbage collection determining what objects to keep by going through the program’s references. The verbose option (`] gc -v`) prints out the active manifests before doing the cleanup. If you delete a manifest file then go through `Pkg.gc`, it’ll be untracked. PkgCleanup.jl is a way to untrack manifests from one place rather than more drastic measures at every listed path manually.

> [@ohmsweetohm1](#):
>
> I would not expect that to work, without any hassle. In the meantime I probably have updated Julia.

Well yes, you do need to start a session with a Julia version matching the manifest’s. But the point of an _active_ manifest is to record all the _already_ installed dependencies to load when you activate its environment, skipping installation and precompilation. If that doesn’t work, something has gone wrong, like if Python’s isolated virtual environments just lost packages, or you never activated the environment in the first place, like if someone provided you with a requirements.txt file.

---

<div class="post-metadata">

**Author:** ![ohmsweetohm1](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ohmsweetohm1/32/49126_2.png) [@ohmsweetohm1](https://discourse.julialang.org/u/ohmsweetohm1)\
**Post date:** [April 13, 2025, 8:53am UTC](https://discourse.julialang.org/t/prune-compiled-folder/109567/20 "2025-04-13T08:53:27Z")

</div>

> [@Benny](#):
>
> If you delete a manifest file then go through `Pkg.gc`, it’ll be untracked.

In the same folder? How would do that? I simply delete the whole folder. Or does it check if the manifest at that path still exists?

[Next page](https://discourse.julialang.org/t/prune-compiled-folder/109567.md?page=2)
