Remove build artifacts.
Synopsis
hx clean [OPTIONS]Description
The clean command removes build artifacts from your project, freeing disk space and ensuring a fresh build.
Options
--full Remove all artifacts including cached dependencies
--dist Remove only dist-newstyle (default)
--hx Remove .hx directory
--dry-run Show what would be removed
-v, --verbose Show detailed outputExamples
Standard Clean
hx cleanRemoves:
dist-newstyle/directory
Full Clean
hx clean --fullRemoves:
dist-newstyle/.hx/(project metadata)- Local package cache
Dry Run
hx clean --dry-runOutput:
Would remove:
dist-newstyle/ (1.2 GB)Clean .hx Directory
hx clean --hxRemoves hx-specific project metadata.
What Gets Removed
Default (--dist)
dist-newstyle/
├── build/ # Compiled objects
├── cache/ # Build cache
├── packagedb/ # Package database
└── tmp/ # Temporary filesFull (--full)
dist-newstyle/
.hx/
├── cache/ # hx-specific cache
└── bhc.toml # Generated BHC manifestWhen to Clean
Clean when:
- Disk space is low
- Build is corrupted
- Switching GHC versions
- Debugging build issues
Usually NOT needed:
- Regular development (incremental builds are faster)
- Before committing (build artifacts are gitignored)
Disk Usage
Check build directory size:
du -sh dist-newstyleSample output:
2.1G dist-newstyleRebuild After Clean
After cleaning, rebuild:
hx clean
hx buildNote: First build after clean takes longer as everything recompiles.
.gitignore
These directories should be in .gitignore:
dist-newstyle/
.hx/hx includes these in new projects automatically.
See Also
- hx build — Build the project