Bottom Line: It is 100% safe to delete _build and deps folders in Elixir and Phoenix projects. Running mix clean or wiping these folders will not delete your .ex source files.
What are the _build and deps Folders?
Located inside Elixir and Phoenix Framework projects, _build and deps are created by the Mix build tool.
deps/: Contains local copies of Hex packages and Git dependencies downloaded by Mix._build/: Stores compiled Erlang BEAM bytecode (.beam), protocol consolidations, and static assets for dev, test, and prod environments.
If you work on multiple Elixir projects, _build artifacts and deps repositories can accumulate gigabytes of obsolete build clutter.
Can You Delete _build and deps?
✅ Yes, it is completely safe to delete.
- Zero code loss: Your Elixir code, Phoenix templates,
mix.exs, andmix.lockremain untouched. - Auto-rebuilt: Running
mix deps.getandmix compilewill re-fetch dependencies and compile a fresh_buildfolder.
How to Safely Clean Up Elixir Build Folders
Method 1: Using Built-in Mix Commands (Recommended)
To clean compiled BEAM build files for the current environment:
mix clean
To clean build files across all environments (dev, test, prod):
mix clean --all
Method 2: Manual Directory Wipe
To force a complete dependency and build reset:
# macOS / Linux
rm -rf _build deps
# Windows (PowerShell)
Remove-Item -Recurse -Force _build, deps
Related Guides
- Learn about deleting node_modules folders.
- How to clean up Python venv folders.
- Check if you can clean git folders.
Discussion
Loading authentication...