dua Setup: Interactive Disk Usage in the Terminal
dua (Disk Usage Analyzer, Homebrew package dua-cli) is a Rust disk usage tool with an interactive terminal UI.
It highlights rolled-up directory sizes so you see what actually consumes space.
Install
Section titled “Install”The Homebrew formula ships the dua command:
brew install dua-cliCheck:
dua --versionInteractive Mode
Section titled “Interactive Mode”dua i opens the TUI (same as dua interactive):
dua i ~dua i /Volumes/YourDriveNavigate with arrow keys, drill into directories with Enter, quit with q. Replace /Volumes/YourDrive with your mount path.
Keyboard Shortcuts
Section titled “Keyboard Shortcuts”| Key | Action |
|---|---|
↑ / ↓ | Move selection |
Enter | Open directory |
d | Mark selection for deletion |
u | Undo mark |
q | Quit |
? | In-app help |
Bindings can change between releases; ? inside dua i is authoritative.
Deletion marks are destructive once you confirm — prefer dry runs on copies or backups until you trust the workflow.
Aggregate Listing (Non-Interactive)
Section titled “Aggregate Listing (Non-Interactive)”Without the interactive subcommand, dua aggregates paths you pass (same underlying idea as dua aggregate, alias dua a):
dua /Volumes/YourDrivedua aggregate /Volumes/YourDrive
dua ~Use dua aggregate --help for byte format (metric, binary, MiB/GiB, and similar), threads, and --stay-on-filesystem (-x) when you must not cross mounts.
Ignore Apple Metadata Directories
Section titled “Ignore Apple Metadata Directories”Spotlight, revisions, and event logs can confuse scanners or flood errors. Skip them with repeated --ignore-dirs:
dua i /Volumes/YourDrive \ --ignore-dirs /Volumes/YourDrive/.DocumentRevisions-V100 \ --ignore-dirs /Volumes/YourDrive/.Spotlight-V100 \ --ignore-dirs /Volumes/YourDrive/.fseventsdAdjust names if your volume uses variants (for example .DocumentRevisions without -V100).
Optional Aliases for ~/.zshrc
Section titled “Optional Aliases for ~/.zshrc”# dua — disk usage TUIalias dh='dua i ~'alias dv='dua i /Volumes'Reload source ~/.zshrc. Use dv only when multiple volumes are mounted and you intend to pick one inside the UI.
Compare dua, du, and ncdu
Section titled “Compare dua, du, and ncdu”| Tool | Role |
|---|---|
du / du -sh | Always available; great one-off summaries, no TUI |
ncdu | Classic ncurses disk explorer (brew install ncdu) |
dua | Rust TUI; interactive dua i plus script-friendly dua <path> |
Pick one primary TUI per habit; dua and ncdu overlap for exploration.
Troubleshooting
Section titled “Troubleshooting”Operation not permitted or (os error 1)
Section titled “Operation not permitted or (os error 1)”macOS privacy (TCC) can block reads even when Unix permissions look fine. Grant Full Disk Access to your terminal app and retry — walkthrough in Fix TCC / Full Disk Access on External Disk Permissions and Disk Usage.
Errors Under .Spotlight-V100 or .DocumentRevisions
Section titled “Errors Under .Spotlight-V100 or .DocumentRevisions”Use --ignore-dirs as above; those directories are system-managed and rarely belong in manual cleanup via dua.
Want File Names Without Folder Totals
Section titled “Want File Names Without Folder Totals”Use eza (listings with color) tree modes; use dua when the question is how much space each subtree uses.