# What can I remove from /.julia?

**URL:** <https://discourse.julialang.org/t/what-can-i-remove-from-julia/121657>\
**Category:** General Usage\
**Tags:** docker, sysimage\
**Created:** [October 23, 2024, 4:17pm UTC](https://discourse.julialang.org/t/what-can-i-remove-from-julia/121657 "2024-10-23T16:17:29Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![mrufsvold](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mrufsvold/32/31600_2.png) [@mrufsvold](https://discourse.julialang.org/u/mrufsvold)\
**Post date:** [October 23, 2024, 4:17pm UTC](https://discourse.julialang.org/t/what-can-i-remove-from-julia/121657/1 "2024-10-23T16:17:29Z")

</div>

I am trying to build a slim docker image to run an app. I’m using PackageCompiler.jl to build a sysimage (using `filter_stdlibs`).

I’d like to remove unnecessary files from the `.julia` file to slim even more. I feel pretty safe removing `share/doc` and `share/julia/test` directories, but is there anything else?

1. Can I remove the original sysimage shipped with Julia? If so, am I right to assume that it is saved at `lib/julia/libjulia.so`?
2. Can I delete stdlib directories from `juila/compiled/v1.10/` that I’m confident I’m not using?
3. How about the stdlib source code?

---

<div class="post-metadata">

**Author:** ![goerz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/goerz/32/3269_2.png) [@goerz](https://discourse.julialang.org/u/goerz)\
**Post date:** [October 23, 2024, 7:17pm UTC](https://discourse.julialang.org/t/what-can-i-remove-from-julia/121657/2 "2024-10-23T19:17:13Z")

</div>

You can pretty safely delete the entire folder, except maybe the `dev` subfolder, which may have packages that you’ve installed via `] dev`.

On that note, I generally recommend against using `dev` to clone packages into your `~/.julia/dev` folder. Instead, clone them first to a better location, using git, and then dev-install them with `] dev <folder>`. If you do that, there should be no problem at all with deleting `~/.julia`. It will be re-created the next time your run Julia.

---

<div class="post-metadata">

**Author:** ![mrufsvold](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mrufsvold/32/31600_2.png) [@mrufsvold](https://discourse.julialang.org/u/mrufsvold)\
**Post date:** [October 23, 2024, 7:55pm UTC](https://discourse.julialang.org/t/what-can-i-remove-from-julia/121657/3 "2024-10-23T19:55:17Z")

</div>

How could it be that I can delete the whole thing? To use the system image, you need to run `julia --sysimage /path/to/sysimage.so`. So If I delete the whole thing, I won’t have an executable to run the system image. Or maybe I’m missing something?

---

<div class="post-metadata">

**Author:** ![goerz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/goerz/32/3269_2.png) [@goerz](https://discourse.julialang.org/u/goerz)\
**Post date:** [October 23, 2024, 8:39pm UTC](https://discourse.julialang.org/t/what-can-i-remove-from-julia/121657/4 "2024-10-23T20:39:56Z")

</div>

You don’t have to run `julia` with _any_ flags. The `--sysimage` flag is for when you’ve created a _custom_ system image manually (which, personally, I’ve only ever done once, to potentially speed up the time-to-first-x for a simulation on an HPC cluster).

I’ve definitely deleted my `~/.julia` folder on many occasions, and it doesn’t affect Julia at all. Except of course that you have to re-install and re-compile all the packages that you’ve had in your base environment. In fact, that’s how people usually clean up their base environment if they’ve made the mistake of installing too many packages in there, instead of doing proper project environments.

Apart from `dev`, if you’ve manually made “unsaved” changes in the folder, there’s nothing in `~/.julia` that can’t be easily recreated. It’s basically a cache folder.

---

<div class="post-metadata">

**Author:** ![lmiq](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lmiq/32/18314_2.png) [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Post date:** [October 23, 2024, 9:13pm UTC](https://discourse.julialang.org/t/what-can-i-remove-from-julia/121657/5 "2024-10-23T21:13:32Z")

</div>

Maybe just keep a copy of your `.julia/config/startup.jl`

---

<div class="post-metadata">

**Author:** ![mrufsvold](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mrufsvold/32/31600_2.png) [@mrufsvold](https://discourse.julialang.org/u/mrufsvold)\
**Post date:** [October 23, 2024, 9:20pm UTC](https://discourse.julialang.org/t/what-can-i-remove-from-julia/121657/6 "2024-10-23T21:20:47Z")

</div>

Okay, I figured out the confusion – my installation of `juliaup` installs versions of Julia inside the `.julia` folder. So if I were to delete `.julia`, it would also delete the Julia executable. I asked about the `.julia` directory because I thought I was referring to “the place where the Julia executable and its dependencies live.”

So, to go back and ask this question correctly –

What can I delete from the `julia` (no leading period) directory where Base, stdlib, etc. are stored?

- I know I can delete `test` and `docs` and Julia will still run.
- Since I have compiled a custom sysimage, I think I can delete the original sysimage, but I’m not sure where that lives.
- I was hoping to delete the compiled binaries that are used by stdlib package I’m not using. Would that cause issue for Julia trying to start?
- Anything else?

---

<div class="post-metadata">

**Author:** ![StevenSiew](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevensiew/32/218393_2.png) [@StevenSiew](https://discourse.julialang.org/u/StevenSiew)\
**Post date:** [October 24, 2024, 11:50pm UTC](https://discourse.julialang.org/t/what-can-i-remove-from-julia/121657/8 "2024-10-24T23:50:00Z")

</div>

You can delete everything (under .julia) EXCEPT these three subdirectories

```julia
$ ls -d ~/.julia/config ~/.julia/environments ~/.julia/juliaup
/Users/ssiew/.julia/config /Users/ssiew/.julia/juliaup
/Users/ssiew/.julia/environments

```

It might be better if you kept a backup copy of these three directories before deleting anything.

postscript: after you delete them, EVERYTHING will take a LONG TIME to run as everything needs to be compiled from stratch again. Time to take a walk in the garden.
