Repository navigation
macOS support: native Trash, APFS-aware scans, a signed app bundle - #13
Merged
Merged
Conversation
disktree built and drew on macOS already, through GPUI's Metal backend, but the Linux plumbing underneath did not carry over. This makes it work well there, without unsafe code, and tightens removal safety for every platform on the way. Trash and removal - On macOS always the system Trash, through NSFileManager (the trash crate): the same move as Finder's, into the item's own disk's Trash. gio/trash-put/XDG would put files in ~/.local/share/Trash, which Finder never shows. - Refuse a directory holding the home directory (/Users is on the same volume as / on macOS) or a system tree (/opt holds /opt/homebrew); add /System, /Library, /private, /opt/homebrew, /cores, /Network. - Refuse a directory with a mount inside it; on macOS the mount list comes from /sbin/mount, read on a background thread. - Permanent deletion walks the tree itself and stops at a mount boundary, like rm -rf --one-file-system (the walker is from tobi#10). - Guards see through /System/Volumes/Data spellings and, on macOS, case. Scanning - Skip /System/Volumes/Data when scanning /: it is /Users, /Applications and the rest again under firmlinks, so / was counted twice. - Whole disk (g, --disk) works: the disk root and device come from statfs. - Never list cloud-only (dataless) iCloud/File Provider folders, which would download them. - Keep a file's identity only when it has more than one name. App - Explain unreadable items when Full Disk Access is missing, with a button to the privacy settings. - A menu bar: Open Folder… (⌘O), Show in Finder (o, ⌘⇧R), Rescan (⌘R), Hide, Quit; closing the window quits; other ⌘ chords are not read as plain letters; help shows ⌘. - Follow the system light/dark appearance when no Omarchy theme exists. - Worth a look knows Xcode DerivedData, DeviceSupport and ~/Library/Logs. - git: skipped without the developer tools (its stub opens a dialog), and never runs a checkout's programs: fsmonitor, hooks and pager off, and no status for a checkout that defines its own filter drivers. Packaging - cargo xtask bundle builds disktree.app and a zip: Info.plist (bundle id io.github.tobi.disktree, macOS 11+), an icon drawn from an SVG on the macOS grid, ad-hoc or Developer ID signing, and --notarize. - make install on macOS puts the app in ~/Applications and links ~/.local/bin/disktree to it. - CI lints, tests and bundles on macOS; the release adds an arm64 macOS zip, signed and notarized when the repository has the Apple secrets.
pull Bot
pushed a commit
to jasonkneen/disktree
that referenced
this pull request
Sep 25, 2026
One set of removal guards for all three platforms: guard_key folds macOS firmlinks and case, and now Windows case and verbatim prefixes, so within/same from tobi#14 become key comparisons. System trees are one keyed list per platform. Fixed while merging: - plan() found home through $HOME, which Windows does not set, so every home guard was off there; std::env::home_dir() instead. - Scan: tobi#14's Listed/Facts shape with tobi#13's never-scanned paths, dataless iCloud folders and track-only-shared-inodes; OneDrive cloud-only folders are skipped the same way on Windows. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

disktree already builds and draws on macOS through GPUI's Metal backend, but the Linux plumbing underneath didn't carry over. On a Mac today:
~/.local/share/Trash, which Finder never shows, while the app says they can be recovered./counts user data twice./Usersand/System/Volumes/Data/Usersare the same inode on the same device.g,--disk) does nothing, because it reads/proc/self/mounts./Users,/optand/Volumescould all be marked in a whole-disk scan, and a permanent delete of/Userswould empty the home directory before failing.This PR fixes those and makes disktree behave like a Mac app. It adds no
unsafecode. Several ideas come from the other open macOS PRs, credited below.Trash and removal
NSFileManagervia thetrashcrate (a macOS-only dependency). It's the same move Finder makes, into the Trash of the item's own disk. There's no Automation prompt and no/usr/bin/trash, which only exists on macOS 15 and later./sbin/mount, read on a background thread because the review screen plans on every frame;/System,/Library,/private,/opt/homebrew,/coresand/Network, added to the system trees.rm -rf --one-file-system. The walker is from Never delete into a filesystem mounted inside a marked directory #10; this PR compares mount IDs where Linux has them, so a btrfs subvolume that isn't mounted goes with its directory./System/Volumes/Data/...paths as/...and ignore case on macOS. They also match the home directory by device and inode.Scanning
/skips/System/Volumes/Dataand/Network. Staying on one filesystem still works by comparing devices.statfs. The Data volume maps to/, so widening from~reuses the tree that's already measured.App
o, ⌘⇧R, via GPUI'sreveal_path), Rescan (⌘R), Hide and Quit.~/Library/Logs./usr/bin/gitstub opens an install dialog.git statusruns a file'scleanfilter, and no-coption can switch off filter names it doesn't know.Packaging
cargo xtask bundlebuildstarget/bundle/disktree.appand a zip, using only tools that ship with macOS or Xcode:Info.plistwith bundle idio.github.tobi.disktree, macOS 11+, and the folder-access prompt texts;packaging/macos/AppIcon.svgon the macOS icon grid;--sign;--notarizenotarizes, staples and checks the result.make installon macOS puts the app in~/Applicationsand links~/.local/bin/disktreeto it.macos-15. The release adds adisktree-*-aarch64-macos.zip, signed and notarized only when the repository has the Apple secrets listed inrelease.yml. Without them the zip is signed ad hoc.Verified
cargo xtask lintandcargo xtask testpass on macOS 26 (Apple silicon), with 148 tests.disktree-corealso passes clippy forx86_64-unknown-linux-gnu.git status. A test now covers this.Not verified
Related
It overlaps with #1, #3, #7 and #8 (macOS) and with #6 and #10. This PR takes #10's deletion walker and git settings, and ideas from #3 and #8.