Doom consumes a lot of harddrive space

The average, reasonably-complex (and vanilla) Emacs config will consume ~100mb of space.

The average, similarly complex Doom config can consume between 3 and 15 times that (between 250mb and 1.5gb), depending on what packages you have installed, and how long you go without running doom purge.

Why? And can I reduce its usage?

A couple reasons:

  1. Doom’s package manager (straight.el) clones packages from their source. This sometimes includes unrelated files, connected codebases (submodules), and/or binary assets.

  2. Some Emacs packages are served as part of a much larger git repository (i.e. you’ll download a 5mb repo for 10kb worth of text files).

  3. When you’ve disabled modules or packages, those packages (and their build artifacts) aren’t removed from your harddrive until you do a purge.

  4. When you’ve changed your installed version of Emacs, Doom creates a new build directory, leaving the old one lying around until you do a purge.

  5. Servers and programs installed by Emacs packages (like LSP servers, epdfinfo or vterm-module.so) are stored under ~/.emacs.d/.local. These can easily consume a lot of space.

  6. (native-comp users only) ELN files can add up to hundreds of mb, and they aren’t deleted until you do a purge.

How do I perform a purge?

Either doom sync -p to do it as part of a doom sync, or doom purge -g.

This will:

  1. Convert all package repos to shallow clones and prune/gc them.
  2. Delete orphaned package builds and repos (e.g. from previous Emacs versions or disabled modules).
  3. Delete any temporary packages installed with M-x package-install
  4. (For native-comp users) Delete left-over *.eln from previous version of native-comp or unused packages.

This can shave approximately 10-30% of the used space, but that is as good as it gets. The upper limit of a Doom config (with all its modules enabled) is around 1.5gb. Unless space is very limited, it isn’t something to worry about, and that extra data is necessary for Doom’s backup and rollback functionality.