Repository navigation
Documentation
- Animated terminal demo on the README and the website: a 25-second recording of
--version, a--dry-run(16 paths, 4.4G that would be excluded) and an apply, plus atmutil isexcludedcheck. The GIF lives indocs/assets/demo.gifand is copied into_site/assets/byscripts/build-site.sh. Regenerated withdocs/demo/generate.sh(sources and notes indocs/demo/). - The website has install commands and an English version (#179): a Homebrew install and
--dry-runblock opens the page. The French (/) and English (/en/) pages are generated byscripts/build-site.shfrom one template (site/src/index.template.html) and one text file per language (site/i18n/<code>.lang); the build fails on a missing, unknown or unused key.make check-siteis part ofmake check, andtests/test_site_build.shpart ofmake test. Shared links to the site show a preview image,docs/assets/social-preview.png(#185). - Maintainer and security documents (#198):
MAINTAINERS.mdlists who can access sensitive project resources and their roles,docs/THREAT_MODEL.mddescribes the threat model anddocs/DEPENDENCIES.mdthe dependency policy.SECURITY.mdlinks to them, and.vex/tm-exclusions.openvex.jsonrecords, in OpenVEX format, known findings that do not affect the released CLI.
Changes
- The report inventory is opt-in (#152): the
=== Inventory (informational) ===section (installed applications with sizes, Homebrew casks and formulae, PATH tools; about 270 lines, aduper.app) is no longer collected or printed by default. Add--inventory, orsetting|inventory|truein a config file, to get it as before (the flag always enables it;TM_EXCLUSIONS_SKIP_INVENTORY=1still wins). The saved report keeps the section heading with one line saying how to enable it, interactive runs print no inventory block, and noduper application,brew listor PATH scan runs, so default runs are faster (brew --cachestill runs on every run for cache discovery, outside the inventory).setting|inventoryacceptstrue/1/yesandfalse/0/no(an invalid value warns and is ignored;scripts/check-conf.shvalidates it too). Option A of the issue; the Opportunities idea (option B) is not part of this change. English and French--helplist the new flag. Covered bytests/test_apps_inventory.sh,tests/test_path_inventory.shandtests/smoke.bats-like.sh. - The report splits disk usage by exclusion status:
Disk usage total: 174.8Gsummed the size of every touched path, including those whose exclusion was blocked or failed (so not excluded), next to aSpace excluded: 32.5Mthat counted only the new additions. It is replaced by three lines:Excluded on disk (total):(paths really excluded: already excluded plus added by the run; only the already excluded with--dry-runand--report-only),New this run:(the formerSpace excluded, same value; still labelled simulated or needing exclusion in--dry-runand--report-only) andUnder blocked or failed rules (upper bound):(paths under a blocked or failed rule, shown only when there is one; an upper bound because a blocked rule can cover children already excluded). The detailed "Disk usage" section is unchanged.--uninstallno longer prints a size total. English and French labels are aligned. --tmuxstacks the panes: the progress/status pane is now on top and the log pane below it, both at full terminal width (split-window -v), instead of side by side. Long paths in the progress line and in the trace lines are cut less.- Application bundle skips (#158). The bundle guard already covers Electron build output (since #143). The report lists each discovered bundle match, including nested matches reached with a
keeprule. Smoke tests cover nested matches and a lowercasecontentsdirectory withInfo.plist. - Test suites run under the pinned
/bin/basheven with Homebrew bash first onPATH(Bash 3.2 on macOS; the system bash on Linux, so Linux CI does not check 3.2): the Makefile exports abashsymlink to it first inPATHfor test runs, so everybashthe suites or their children start —env, shebangs, hook internals, tmux panes — uses it. The shim dir is per-user and mode 700, and setup refuses a planted symlink, foreign owner or wrong mode. Each suite prints its own shell version and the shim target on stderr.
Fixes
-
--versionand the report header no longer rewrite.git/index(#171):git describe --dirtyrefreshes the index and writes it back, even withGIT_OPTIONAL_LOCKS=0, so a read-only command modified the source checkout (and asudorun could leave.git/indexowned by root). The build info now comes fromgit describewithout--dirtyplusgit status --porcelain --untracked-files=no, both run with--no-optional-locks, so.git/indexis never rewritten (git's own optional features, split index and fsmonitor, may still touch other files under.git, such as.git/sharedindex.*or the.git/fsmonitor--daemoncookies). The dirty flag keeps its meaning (tracked files changed or staged; untracked files ignored), and a file that was only touched is not reported as dirty. Two read-only git calls instead of one; ifstatusfails (corrupt or unreadable index) the plain version is shown, as whendescribe --dirtyfailed. Covered bytests/test_version_display.sh(inode and checksum of.git/indexunchanged after--versionand a report run). -
--tracecompletes with stderr closed on macOS Bash 3.2 (#160). The scan writes its report and keeps its normal exit status. -
Report files are private (#149): the saved report (default path,
setting|report_pathorTM_EXCLUSIONS_REPORT) and the Desktop copy were written with the current umask (usually0644), so other local accounts could read the list of installed apps,PATHdirectories and project paths. They are now created with mode0600, and an existing file is set to0600before it is rewritten, including a read-only (0444) file the user owns, which was a write failure before. Covered intests/smoke.bats-like.sh. -
Dry runs predict privilege blocks (#146): planned exclusions and removals that need unavailable sudo report
BLOCKED. When sudo is usable, the verbose terminal output and report mark the planned change with(sudo). Dry runs never prompt for sudo. -
Interactive runs prompt for sudo instead of reporting
BLOCKED(#163): the terminal check ran inside the processing loops, whose stdin is a heredoc, so it was always false and a privileged path was blocked even in a terminal. Interactivity is now decided once at startup. With a terminal and no sudo cache, the first privileged change prompts once and the keepalive covers the rest; a failed prompt blocks the remaining privileged paths without asking again. Non-interactive runs (cron, launchd, CI) keepBLOCKED. The dry run predicts the same route, marks it(sudo), and still never prompts. -
Partially readable paths contribute to the report counters (#147). The counters reuse the partial sizes shown in the Disk usage section and display a lower bound.
-
The per-path size column truncates partial sizes too (#164): a partially readable 2047 KiB path showed
2.0Min the verbose per-path column but1.9Min the Disk usage section and the counters. The column now uses the same lower bound. Complete sizes keep their rounding. -
Pattern matches inside application bundles are skipped, not excluded: a
node_modulesinsideSome.app/Contents/Resourcesis part of the installed app andnpm installcannot rebuild it.tmutil addexclusionalso fails on some of these paths, which gave a persistentERRORon every run. Apply,--dry-runand--report-onlynow report such a match asSKIP (inside an application bundle)in the report and the trace, count it as checked and skipped, and make notmutilcall for it. Only a real bundle counts: the path must be under<name>.app/Contents/and<name>.app/Contents/Info.plistmust exist, and both.appandContentsare matched without regard to case. A repository or folder merely named*.appis still processed.--uninstallis unchanged, so it still removes exclusions added by earlier versions. Covered intests/smoke.bats-like.sh. -
The
ERRORline shows whytmutil addexclusionfailed: the report, the log and the trace now append the one-linetmutilerror text, for exampleError excluding: /path (reason). Control characters (CR, LF, ESC, tab) become spaces and the text is cut at 200 characters. -
Privilege blocks have their own counter.
Blocked (privileges)counts separately fromErrors. A run with a privilege block still exits with status 1. -
Prune zones are reported as
PRUNE, under their own category: the report showed them asSKIP <path> (Pruning (skipping scan of):), filed under "Uncategorized" and not counted anywhere distinct. They now readPRUNE <path> (scan skipped, not an exclusion), sit under a dedicated "Prune zones" category with the covering rule's provenance, and are counted by a newPrune zones:line in the report header and the console.Skipped:is unchanged. Tests that pinned the oldSKIP … Pruningformat now assert the newPRUNEcontract. WithTM_EXCLUSIONS_NO_SCAN_PRUNE=1, a match below a prune zone is counted in “Summary by rule” under the coveringprunerule instead of thepatternrule. -
--traceno longer lists the inside of pruned matches: theWALKpass replayed the prune zones and static exclusions but not the name-based pruning (layer 3). It listed every package under eachnode_modules(and other unconditional matches) although the work scan never descends there. The walk now lists the match once, then prunes it, like the work scan. WithTM_EXCLUSIONS_NO_SCAN_PRUNE=1, orkeeprules, the walk still descends, as the work scan does. -
--uninstallverifies privileged removals (#158). It checks an excluded symlink target against its own parent and removes fixed-path exclusions from the target. An unreadable parent on the writable route does not trigger the sudo fallback. After a successful privileged removal, an unreadable status reportsERROR. An excluded child can reportREMOVEwhen its parent is confirmed excluded and its sticky attribute is absent. A writable child processed before its excluded parent can still need two runs to clear a fixed-path exclusion. When the parent is excluded outside the tool's rules, it stays excluded, so the sudo fallback is skipped, the child's fixed-path exclusion is never removed and every run reportsREMOVE. -
Documented an
--uninstallverification limit (#174). If an item remains excluded through its parent andxattrcannot read it, a run reportsERROReven after a successful privileged fixed-path removal, and repeats it whenever a later run again reaches that check (a run without usable sudo reportsBLOCKEDinstead). -
Every
--tracetoken has its own colour in the--tmuxlog pane:TMUTIL,SKIP,KEEP,PRUNEandWALKwere only dimmed and looked uncoloured, and several tokens shared a colour. Each of the 16 tokens now has a distinct colour from the 256-colour palette (for example greenADD, orangeREMOVE, bold redERROR, blueTMUTIL). The colours are mid-luminance, with at least 3:1 contrast on both a dark and a light pane. Debug files and FIFOs stay plain. Tests check that every token the script emits gets a distinct, non-dim colour that meets that contrast. -
The
--tmuxlog pane now looks like the status pane: the log pane printed bare log lines, with no spacing and no colours, so categories and actions were hard to tell apart. In the tmux child only, the debug log stream now receives the same indented, coloured lines as the terminal (green ✓ for exclusions, cyan for dry-run, heading colour for━━section titles and══ Category ══, yellow ⚠ for warnings and errors, a blank line between entries). The--tracevocabulary stays: in the pane only, each token takes its own colour (see the entry above) and the timestamps are dimmed. Debug FIFOs and files used outside--tmuxstay plain. Covered intests/test_tmux_ui.sh. -
The progress line keeps its information in narrow panes: in
--tmux, the left pane measured its width once, while the detached session still had tmux's 80x24 default, then kept that stale width after the client attached. The status line (for exampleMe…uvwhile measuring a folder) was cut far below the real pane width. The session is now created at the terminal size, the width is read again at most once per second, and the activity line keeps the stage name whole and shortens the path from its start (Measuring directory …/folder/name/uv). After a folder is measured, its path stays on screen instead of an empty line.
Performance
- Faster prune reporting during full traversal (#158). Each prune decision looks up its source in the explicit prune rules collected at config load. With
TM_EXCLUSIONS_NO_SCAN_PRUNE=1, a synthetic tree with 400 matches under one default prune zone took 6.4 s, down from 7.3 s (median of three runs with Bash 3.2). All 400 entries kept the same rule context. - Time Machine statuses are read in parallel: a run checks about a thousand paths, and one
tmutil isexcludedcosts an XPC round trip of 0.07-0.15 s (more while a backup runs), so a full run spent minutes between paths. The candidate lists (static rules, discovered matches, extra paths) are now read once byTM_EXCLUSIONS_STATUS_JOBSconcurrenttmutilprocesses (default 4) before the decision loop, which finds each answer in that table; writes stay one at a time, in order. Measured on a developer Mac with a backup running: status checks went from ~180 s to ~25 s.TM_EXCLUSIONS_STATUS_JOBS=1restores the previous behaviour. The time is not indu: on the same machineTM_EXCLUSIONS_SKIP_DU=1saves ~70 s but leaves the per-path round trips. Covered bytests/test_status_prefetch.sh(one check per path, real concurrency, sequential mode, unreadable status still an error).
Features
-
--versionand the report header show the build of a git checkout (#148): when the script (symlinks followed) runs from a checkout or worktree of this repository (.git,locales/en.shandconfig/default.confnext to it), the displayed version gains the commits since thev<VERSION>tag, the short commit and a dirty flag, for exampletm-exclusions 1.4.1+5 (9171049, dirty). When that tag is not reachable (shallow clone, no tags), the commit is markeduntagged:tm-exclusions 1.4.1 (9171049, untagged). Two read-only git calls,git describeandgit status(see the.git/indexfix for #171 above), only for--versionand the report header. Amake installor Homebrew copy, a copy in an unrelated repository, aPATHwithoutgitor a broken.git(even one inside another repository) prints the plain version as before, with no stderr output.VERSIONandmake versionstayX.Y.Z. Covered bytests/test_version_display.sh. -
User-writable paths outside
$HOMEare excluded without sudo: every path outside$HOMEwas treated as a system path and neededsudo tmutil addexclusion -p, so a non-interactive run without a sudo cache reported it as privilege-blocked and it stayed in the backup. On Apple Silicon this left/opt/homebrew/Cellarand/opt/homebrew/Caskroom(owned by the user, several GB) backed up. The route now follows the write permission (path_needs_privilege()): a path the user can write takes plaintmutil addexclusion(extended attribute, no sudo, no-p), wherever it is. Paths the user cannot write (/private/var/folders,/Library/Developer/CoreSimulator) keep thesudo … -proute and the privilege-blocked report; so does root, for which-wtells nothing. If the attribute cannot be set on a writable path outside$HOME(ACL, SIP), the run falls back tosudo … -p, privilege-blocked without sudo.--uninstallremoves the attribute without sudo and, when the path is still excluded although its parent is not, falls back tosudo tmutil removeexclusion -pfor a fixed-path exclusion left by an older version (privilege-blocked without sudo); a status inherited from an excluded parent never calls sudo. Rollback: revert the commit, thentmutil removeexclusionon the paths excluded this way. Covered bytests/smoke.bats-like.sh(attribute add/remove without sudo, legacy fixed-path removal, inherited status, refused attribute, read-only path still privileged); these cases cannot run as root and are then reported as aSKIP (root)line plus aSkipped blockscount in the suite summary (test_skipintests/test_helpers.sh). -
--tmux's log pane is now a real trace, and--tracemakes it complete: the pane streamed the samelog_infolines as the left pane, batched at the end of each stage, so a scan showed almost nothing while it ran. Every action now writes one line to the debug log as it happens —ADD,OK,SKIP,NEED,WOULD,REMOVE,KEEP,BLOCKED,ERROR, theSCANstart/end counters,MATCH,PRUNEand the exactTMUTILinvocation — in the saved report's untranslated vocabulary, with elapsed seconds. The new--traceflag adds aWALKline per directory the scan visits, streamed from a second pass that reuses the path-based prune layers (prune zones, known static exclusions, photo libraries and newline paths); it also works without tmux (debug FIFO, else stderr) and costs one extra traversal of$HOME. The scan result, the exclusions and the exit status are unchanged. Covered by the newtests/test_trace.sh, including a slow-tmutilscenario that proves the log grows mid-run. -
A closed stderr no longer aborts the run:
log_errorprinted to fd 2 without guarding the redirection, so withset -ea closed stderr (or any write failure) ended the process with status 1 and lost the report. Both branches now ignore the write error. Reproduced on Linux with2>&-under--trace, covered bytests/test_trace.sh.
CI and automation
- actionlint, markdownlint-cli2 and lychee now run in CI (
make lint-workflows,make lint-docs,make check-links). actionlint and markdownlint live in.github/workflows/lint.ymland run on every pull request; the link check lives in.github/workflows/links.yml, runs when documentation changes, and once a week onmaster. They are not part ofmake check. - Dependency review blocks a pull request (#199):
.github/workflows/security.ymlno longer usescontinue-on-errorand fails on a vulnerability of moderate severity or higher. Manual runs ofrelease.ymlandauto-patch.ymlvalidate their inputs (avX.Y.Ztag, a positive integer threshold, a booleandry_run) before using them. The Homebrew tap is updated only with the Housekeeper App token; theHOMEBREW_TOKEN/RELEASE_TOKENfallback is removed. - Hardened workflows: job tokens get minimal permissions and CI dependencies are pinned (#196); workflows run on GitHub-hosted runners (#194); triage runs on
pull_requestinstead ofpull_request_target(#193). - OpenSSF Scorecard workflow and README badge (#191).
- ShellCheck 0.10 and 0.11 agree on indirectly called helpers (#189).