Uninstall Mac apps with every file they leave behind, and see why each belongs. Free up space, fine-tune macOS, and set up Terminal.
Swift cache-cleanercleanerclideveloper-toolsdisk-cleanupdisk-spaceduplicate-finderhomebrewliquid-glassmac-cleanermacosmacos-appmacos-golden-gatemacos-tahoemacos-tweaksswiftswiftuiterminal-themesuninstalluninstaller
Keep the account's crash reports folder and offer only the reports in it
Țugui Dragoșbb6f34223cda
diff --git a/GUIDE.md b/GUIDE.mdindex 01824530..e850b79f 100644--- a/GUIDE.md+++ b/GUIDE.md@@ -108,9 +108,10 @@ simulators, Docker's disk, Rust's toolchains, or Android's NDK versions, Space mwith the command that frees it, when there is one, for you to copy into Terminal: Peel never runs it, since itdeletes for good. In the Library at the top of the disk, Space also lists the caches and logs apps keep for everyaccount, and the crash reports macOS keeps. Those an administrator owns go through Peel's helper, and what macOS-keeps there for its own services is never listed. Nothing is selected for you: Select Recommended takes what Peel-could measure in an area and nothing holds back. Peel can also warn you, with a notification that opens Space, when-less than a tenth of your disk is available: turn it on in Settings > General.+keeps there for its own services is never listed. In your own Logs, the folder macOS saves crash reports in stays and+only the reports are offered, since macOS can't make that folder again. Nothing is selected for you: Select+Recommended takes what Peel could measure in an area and nothing holds back. Peel can also warn you, with a+notification that opens Space, when less than a tenth of your disk is available: turn it on in Settings > General.</details>diff --git a/Packages/PeelCore/Sources/PeelCore/Space/SpaceReport.swift b/Packages/PeelCore/Sources/PeelCore/Space/SpaceReport.swiftindex 0428a83a..024dc42f 100644--- a/Packages/PeelCore/Sources/PeelCore/Space/SpaceReport.swift+++ b/Packages/PeelCore/Sources/PeelCore/Space/SpaceReport.swift@@ -86,8 +86,16 @@ public enum SpaceInventory {} + (isTheUserCacheFolder ? [userCache].compactMap(\.self) : [])}- func onlyFilesIn(root: URL) -> [URL] {- onlyFilesIn.map { root.appending(path: String($0.dropFirst()), directoryHint: .isDirectory) }+ /// True when the area's size is what it offers, child by child, rather than its places measured whole: one+ /// place may sit inside another of its own, which would count twice.+ var measuresWhatItOffers: Bool { leavesMacOSsOwn || !onlyFilesIn.isEmpty }++ func onlyFilesIn(home: URL, root: URL) -> [URL] {+ onlyFilesIn.map { path in+ path.hasPrefix("/")+ ? root.appending(path: String(path.dropFirst()), directoryHint: .isDirectory)+ : home.appending(path: path, directoryHint: .isDirectory)+ }}}@@ -244,12 +252,15 @@ public enum SpaceInventory {paths: ["Library/Mobile Documents/com~apple~CloudDocs"],handling: .readOnly),+ // macOS's analytics helper can't make the account's crash reports folder again once it is gone, so only the+ // reports in it are offered.Definition(id: "logs",category: .library,- paths: ["Library/Logs"],+ paths: ["Library/Logs", "Library/Logs/DiagnosticReports"],handling: .trash,- containerFolders: ["Data/Library/Logs"]+ containerFolders: ["Data/Library/Logs"],+ onlyFilesIn: ["Library/Logs/DiagnosticReports"]),Definition(id: "caches",@@ -350,14 +361,17 @@ public enum SpaceInventory {.filter { !ProtectedData.isApplesName($0.lastPathComponent) }}- /// What an area that leaves macOS's own out can offer in its `folders`: every child not named for macOS and not- /// one of the folders themselves, and only the files where macOS files its reports into folders.- private static func offered(in folders: [URL], of definition: Definition, root: URL) -> [URL] {+ /// What an area can offer in its `folders`: every child that is not one of the folders themselves, only the files+ /// where macOS files its reports into folders, and nothing named for macOS in an area that leaves macOS's own out.+ private static func offered(in folders: [URL], of definition: Definition, home: URL, root: URL) -> [URL] {let paths = Set(folders.map(PathPattern.comparablePath))- let filesOnly = Set(definition.onlyFilesIn(root: root).map(PathPattern.comparablePath))- return folders.flatMap { folder in- let names = (try? FileManager.default.contentsOfDirectory(atPath: folder.path(percentEncoded: false))) ?? []- return names.filter { !isMacOSsOwn($0) }.map { folder.appending(path: $0) }.filter { child in+ let filesOnly = Set(definition.onlyFilesIn(home: home, root: root).map(PathPattern.comparablePath))+ return folders.flatMap { folder -> [URL] in+ // A folder that can't be listed is measured whole, so its size reads as unknown, never as nothing.+ guard let names = try? FileManager.default.contentsOfDirectory(atPath: folder.path(percentEncoded: false))+ else { return [folder] }+ let kept = definition.leavesMacOSsOwn ? names.filter { !isMacOSsOwn($0) } : names+ return kept.map { folder.appending(path: $0) }.filter { child in!paths.contains(PathPattern.comparablePath(of: child))&& !(filesOnly.contains(PathPattern.comparablePath(of: folder)) && child.isRealFolder)}@@ -428,8 +442,9 @@ public enum SpaceInventory {var pending = wanted.makeIterator()func addNext() -> Bool {guard !Task.isCancelled, let (definition, urls) = pending.next() else { return false }- let measured = definition.leavesMacOSsOwn- ? offered(in: urls, of: definition, root: root).filter { !exclusions.excludes($0) } : urls+ let measured = definition.measuresWhatItOffers+ ? offered(in: urls, of: definition, home: home, root: root).filter { !exclusions.excludes($0) }+ : urlsgroup.addTask { (definition, urls, await size(of: measured, leaving: exclusions, measure: measure)) }return true}@@ -445,7 +460,7 @@ public enum SpaceInventory {handling: definition.handling,heldBack: definition.heldBack,leavesMacOSsOwn: definition.leavesMacOSsOwn,- onlyFilesIn: definition.onlyFilesIn(root: root),+ onlyFilesIn: definition.onlyFilesIn(home: home, root: root),commands: definition.commands))}diff --git a/Packages/PeelCore/Tests/PeelCoreTests/SpaceInventoryTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/SpaceInventoryTests.swiftindex 32fca8e9..ecfa56d9 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/SpaceInventoryTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/SpaceInventoryTests.swift@@ -85,13 +85,13 @@ struct SpaceInventoryTests {/// Without Full Disk Access some areas are refused, and a refused one is kept like one that ran out of time.@Test(.permissionsHold) func keepsAFolderItCannotOpen() async throws {let directory = try TemporaryDirectory()- try directory.file("Library/Logs/big.log", bytes: 400_000)- try directory.setPermissions(0, of: "Library/Logs")- defer { try? directory.setPermissions(0o755, of: "Library/Logs") }+ try directory.file("home/Library/Logs/big.log", bytes: 400_000)+ try directory.setPermissions(0, of: "home/Library/Logs")+ defer { try? directory.setPermissions(0o755, of: "home/Library/Logs") }let report = await SpaceInventory.scan(- home: directory.url,- root: directory.url,+ home: directory.url.appending(path: "home", directoryHint: .isDirectory),+ root: directory.url.appending(path: "root", directoryHint: .isDirectory),minimumSize: 100_000,measure: FileSize.measure)@@ -100,6 +100,22 @@ struct SpaceInventoryTests {#expect(!report.needsFullDiskAccess, "ordinary permissions were read as a refusal Full Disk Access would lift")}+ @Test(.permissionsHold) func keepsASharedAreaItCannotListAsUnknown() async throws {+ let directory = try TemporaryDirectory()+ try directory.file("root/Library/Logs/org.example.tool/run.log", bytes: 400_000)+ try directory.setPermissions(0, of: "root/Library/Logs")+ defer { try? directory.setPermissions(0o755, of: "root/Library/Logs") }++ let report = await SpaceInventory.scan(+ home: directory.url.appending(path: "home", directoryHint: .isDirectory),+ root: directory.url.appending(path: "root", directoryHint: .isDirectory),+ minimumSize: 100_000,+ measure: FileSize.measure+ )+ #expect(report.items.map(\.id) == ["system-logs"])+ #expect(report.items.first?.size == nil)+ }+@Test func leavesOutWhatIsExcludedAndWhatItHolds() async throws {let directory = try TemporaryDirectory()try directory.file("Parallels/Example.pvm/disk.hdd", bytes: 400_000)@@ -346,12 +362,14 @@ struct SpaceInventoryTests {let found = Set(places.map { "\($0.item.id): \($0.path)" })#expect(expected.subtracting(found).isEmpty, "\(expected.subtracting(found).sorted())")// A place in two areas, or inside a place measured whole, would count its bytes twice in the total. An area- // that leaves macOS's own measures what is in its places one by one, and passes over a place of its own.+ // that leaves macOS's own, or offers only the files of a place of its own, measures what is in its places one+ // by one, and passes over a place of its own.let twice = places.filter { place inplaces.contains { other inlet isAnotherArea = other.item.id != place.item.id+ let measuresOneByOne = other.item.leavesMacOSsOwn || !other.item.onlyFilesIn.isEmptyreturn (other.path == place.path && isAnotherArea)- || (place.path.hasPrefix(other.path + "/") && (isAnotherArea || !other.item.leavesMacOSsOwn))+ || (place.path.hasPrefix(other.path + "/") && (isAnotherArea || !measuresOneByOne))}}#expect(twice.isEmpty, "counted twice: \(twice.map(\.path).sorted())")diff --git a/Packages/PeelCore/Tests/PeelCoreTests/SpaceRemovalTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/SpaceRemovalTests.swiftindex 474ce0e6..651878d7 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/SpaceRemovalTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/SpaceRemovalTests.swift@@ -229,6 +229,30 @@ struct SpaceRemovalTests {#expect(plan.refused.isEmpty)}+ @Test func offersTheAccountsCrashReportsButNeverTheirFolder() async throws {+ let directory = try TemporaryDirectory()+ for path in [+ "org.example.tool/run.log", "DiagnosticReports/Example_2026-09-28.ips",+ "DiagnosticReports/Retired/panic-full.ips",+ ] {+ try directory.file("home/Library/Logs/\(path)", bytes: 4_000)+ }+ let reports = directory.url.appending(path: "home/Library/Logs/DiagnosticReports", directoryHint: .isDirectory)+ let report = await SpaceInventory.scan(+ home: directory.url.appending(path: "home", directoryHint: .isDirectory),+ root: directory.url.appending(path: "root", directoryHint: .isDirectory),+ minimumSize: 1, measure: FileSize.measure+ )+ let logs = try #require(report.items.first { $0.id == "logs" })++ let plan = await SpaceRemoval.plan(for: logs, environment: environment(directory), running: [:])++ #expect(plan.removable.map(\.lastPathComponent).sorted() == ["Example_2026-09-28.ips", "org.example.tool"])+ #expect(logs.size.map { $0 < 12_000 } == true)+ let removalGuard = RemovalGuard(environment: environment(directory), exclusions: .none)+ #expect(removalGuard.refusal(of: reports) == .staysItself)+ }+@Test(.permissionsHold) func whatOnlyAnAdministratorCanMoveGoesThroughTheHelper() async throws {let directory = try TemporaryDirectory()try directory.file("root/Library/Caches/org.example.updater/data.bin")diff --git a/SAFETY.md b/SAFETY.mdindex 96ec4923..e2b50c30 100644--- a/SAFETY.md+++ b/SAFETY.md@@ -152,6 +152,10 @@ those programs keep theirs, does not list them at all. Neither you nor Peel canasks you to: what it runs from stays, and says so, until it is stopped in Background Items or by the app's ownuninstaller.+The folder your account's crash reports are saved in, `~/Library/Logs/DiagnosticReports`, never moves: macOS's+analytics helper can't make it again once it is gone, and crash reports would stop being saved. Space offers only+the reports in it, as it does in `/Library/Logs/DiagnosticReports`.+A move to the Trash, or back from it, never replaces what is already at the new name. Most disks refuse that bythemselves; on one that cannot, such as exFAT, Peel first takes the name with an empty placeholder, which only afree name allows, and the move then replaces the placeholder.