Skip to content

Elixir and Erlang on a Mac: Hex packages, build folders, and Erlang versions

Hex caches packages, every project keeps _build and deps, and version managers keep each Erlang release. Where the space goes and how to clean it.

4 min read

For an Elixir developer, space goes to three places: the Hex package cache, each project's _build and deps folders, and the Erlang and Elixir versions installed by a version manager.

du -sh ~/.hex ~/.mix 2>/dev/null

# _build and deps across projects
find ~/code ~/Projects -maxdepth 3 -type d \( -name _build -o -name deps \) -prune -exec du -sh {} + 2>/dev/null | sort -h | tail

# Erlang and Elixir versions
du -sh ~/.asdf/installs/* ~/.local/share/mise/installs/* 2>/dev/null

Clean up

# In a project you are not working on
mix deps.clean --all
rm -rf _build

# Hex cache
mix hex.clean 2>/dev/null || rm -rf ~/.hex/packages

Erlang builds are several hundred MB each. Remove versions no project uses with your version manager. See version managers.

Related: rebar3 and Erlang caches.

Common questions

Where does Hex store packages on a Mac?

In ~/.hex, with a packages cache inside.

Can I delete _build and deps in Elixir projects?

Yes. mix deps.get and the next compile recreate them.

How much space does an Erlang install take?

Several hundred MB per version. Version managers keep each one until removed.

Read next