- Switch bytes_to_human (shell) and humanizeBytes (Go) from Base-2
(1024) to Base-10 (1000) to match Apple's storage calculation
standard since Snow Leopard
- Add proper decimal rounding instead of truncation
- Use mdls kMDItemLogicalSize for .app bundles to avoid APFS clone
file undercounting by du
Fixes#511
Use a fast `defaults read` pre-check before spawning any tmutil
process. On machines without Time Machine configured the check
returns instantly, avoiding the spinner and the 2-3s tmutil timeout.
Affected locations:
- lib/clean/system.sh: clean_time_machine_failed_backups()
- lib/clean/system.sh: clean_local_snapshots()
- lib/clean/user.sh: local snapshot hint in system hints
Add support for cleaning old aerial wallpaper videos in:
/Users/user/Library/Application Support/com.apple.wallpaper/aerials/videos
These video files can consume significant disk space (up to 50GB+) and
are safe to remove - macOS will re-download them on demand.
Uses MOLE_SUPPORT_CACHE_AGE_DAYS (default 30 days) to avoid removing
recently used wallpapers.
Closes#508
This commit addresses the issue #506 where mole would exit prematurely
during application support scanning.
Changes:
1. Remove 4 redundant pipefail disable/restore blocks:
- safe_find_delete() in lib/core/file_ops.sh
- safe_sudo_find_delete() in lib/core/file_ops.sh
- fix_broken_preferences() in lib/optimize/maintenance.sh
- opt_saved_state_cleanup() in lib/optimize/tasks.sh
These were unnecessary because process substitution (< <(cmd)) is not
affected by pipefail - only real pipelines (cmd1 | cmd2) are.
2. Fix real bug in fix_broken_preferences():
- Add || true to ((broken_count++)) on lines 35 and 55
- This prevents set -e from exiting when broken_count starts at 0
Fixes#506
Replace hardcoded 70-char string with a dynamically generated divider
capped at terminal width (max 70) so the separator fits narrow terminals
instead of overflowing them.
Change "$DRY_RUN" to "${DRY_RUN:-}" so the check is safe under
set -euo pipefail when DRY_RUN is not exported by the caller (e.g.
unit tests that source lib/clean/system.sh directly without going
through bin/clean.sh which initialises the variable).
Replace blocking read with a timed read (default 3 s) so the prompt
exits automatically instead of waiting forever. Timeout is configurable
via MOLE_UNINSTALL_RETURN_PROMPT_TIMEOUT_SEC. Use a read_ok flag to
distinguish timeout (exit) from Enter (return to list).
- Add confirm_purge_cleanup() to show item count + size and require
explicit Enter/y confirmation before any deletion
- Two-pass layout in clean_project_artifacts: pass 1 collects data,
pre-scan finds max path and artifact widths, pass 2 formats with
consistent column alignment across all rows
- Adaptive footer hints in select_purge_categories degrade gracefully
on narrow terminals (full → reduced → minimal)
- Use printf '\033[J' to clear stale content when list height shrinks
- Guard empty-array expansions with ${arr[*]-} for set -u safety
- Add BATS tests for confirm_purge_cleanup (Enter confirm, ESC cancel)
- Capture terminal width in parent before forking; avoids unreliable
tput calls inside the background subshell
- Write spinner output directly to /dev/tty to prevent stdout state
contention between parent and background processes
- Use \033[2K (erase entire line) instead of \033[K (erase to EOL)
- Add handle_interrupt() so Ctrl-C cleanly stops spinner, restores
cursor, and exits 130
- cleanup_monitor now writes \r\033[2K\n so subsequent output starts
on a clean line rather than on the cleared spinner line
- Fix Messages running check to not skip CrashReporter/idleassetsd cleanup
- Add proper spacing between function definitions
- Add app_support_item_size_bytes() for accurate size calculation
- Improve progress reporting during Application Support scan
Replace du traversal + double find with single find -print0 + stat -f%z
to eliminate 8+ minute hang on directories with 392K files. Add progress
feedback via update_progress_if_needed in the outer loop.
The dry-run mode hardcoded SYSTEM_CLEAN=false, which meant
the entire system section was silently skipped during preview.
Users had no way to see what /Library/Caches, /private/var/log,
diagnostics, or other sudo-required paths would be cleaned.
Now dry-run checks for a cached sudo session (sudo -n) and
includes the system preview when available. When sudo isn't
cached, a hint tells the user how to get the full preview
without running the whole script as root.