LinuxmacOSWindows

Where Does Elixir Store Deps and Build Output?

Elixir projects build into _build with deps beside it, while user-level Mix archives and Hex cache live in ~/.mix and ~/.hex.

Last updated

Elixir projects separate source from artifacts cleanly. The mix.exs file declares dependencies and tasks, mix.lock pins exact versions, and lib holds your code. Compilation output goes to _build (split per environment) and fetched deps land in deps.

User-level state sits outside projects. The ~/.mix folder holds installed archives like hex and phx_new, while ~/.hex caches downloaded packages across projects. Wiping the project folders fixes build weirdness; wiping the home folders forces full redownloads.

Where Elixir stores this, by platform

Linux
[ProjectDir]/mix.exs

Project manifest and lock file. The _build and deps folders beside them regenerate fully; archives in ~/.mix and the package cache in ~/.hex persist across projects.

macOS
[ProjectDir]/mix.exs

Same project-relative layout on macOS. asdf and Homebrew installs agree on the project layout; only the Elixir toolchain location differs.

Windows
[ProjectDir]\mix.exs

Same arrangement on Windows. Path length limits bite _build on deeply nested projects, so keep project roots shallow or enable long paths.

Frequently asked questions

A Phoenix build acts haunted. What do I wipe?

Delete _build and deps, then fetch and compile again. Both regenerate from mix.exs and mix.lock. Never commit them; the lock file pins versions so rebuilds stay identical.

Which Elixir folders belong in git?

Yes. Commit mix.exs and mix.lock plus lib, config, and priv. The _build, deps, and cover folders are output, and the hex cache in ~/.hex is per-machine scratch.

Notice an outdated path? Let us know.