Ultra-fast node_modules cleanup tool powered by Bun.js
Faster than npkill with advanced interactive features and accurate size reporting
BunKill scans large directory trees, calculates folder sizes, and lets you delete selected node_modules folders from an interactive terminal UI or in batch mode.
- fast scanning for
node_modulesin large trees - concurrent size calculation with live progress
- interactive cleanup UI with keyboard selection
- interactive search after results load
- multiple sort modes
- largest first
- newest first
- oldest first
- name
- path
- developer-friendly badges in the UI
- package manager
- git branch / dirty state
- staged changes
- recently touched project marker
- dry-run and
--delete-allmodes - update checks with short timeout and clear status
- JS/Bun implementation only
- Bun is required at runtime
- macOS is the only platform tested so far
Install Bun if needed:
curl -fsSL https://bun.sh/install | bashnpm install -g bunkillor
bun install -g bunkill# interactive scan in current directory
bunkill
# scan a specific directory
bunkill --dir ~/Projects
# preview only
bunkill --dir ~/Projects --dry-run
# delete everything found without interactive selection
bunkill --dir ~/Projects --delete-all
# limit traversal depth
bunkill --dir ~/Projects --depth 3
# check for updates manually
bunkill update --check-only--dir <directory>scan root, defaults to current directory--target <name>target folder name, defaults tonode_modules--exclude <patterns...>skip paths containing these substrings--exclude-hiddenskip hidden directories--hide-errorssuppress permission errors--full-scanscan from the home directory--depth <number>max traversal depth, default10--dry-runshow results without deleting--delete-alldelete all discovered targets without interactive selection
↑/↓movespaceselect current item/search loaded resultscclear searchaselect or clear all visible resultsscycle sort orderdtoggle detailsoopen directoryenterdelete selectedqquit
Search filters the already loaded list, so you can quickly narrow large result sets without rescanning.
- macOS: tested
- Linux: not tested yet
- Windows: not tested yet
Linux and Windows may work, but they have not been validated in this repo yet.
Contributions for Linux and Windows testing or fixes are welcome.
Recent real scan on --dir /Users/himanshum:
- completed in about
24.45s - found
265node_modulesdirectories
More benchmark notes:
BENCHMARK.mdbenchmark/installed-vs-local-benchmark.tsbenchmark/three-way-benchmark.ts
bun install
bun run check
bun run src/cli.ts --dir ~/Projects --dry-runsrc/cli.tsCLI entry pointsrc/scanner.tsscan and delete enginesrc/config.tsshared runtime and scan configsrc/types.tsshared typesbenchmark/benchmark scripts
Contributions are welcome.
Especially useful:
- Linux testing
- Windows testing
- terminal UI improvements
- scan performance improvements
- bug reports with reproducible directories or logs
If you are working on bunkill or want to contribute around that ecosystem, contributors can get a free on-chain URL from urls.bid dm me on x.
- BunKill uses Bun at runtime via
#!/usr/bin/env bun - the scanner is JS/Bun-only now
- the old Zig/native experiment was removed
- the name "BunKill" is a playful nod to "npkill" and reflects the Bun.js foundation of the tool