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
Offer the crash reports macOS files into a folder inside its reports folder
Țugui Dragoș985733158d5f
diff --git a/Packages/PeelCore/Sources/PeelCore/Space/SpaceRemoval.swift b/Packages/PeelCore/Sources/PeelCore/Space/SpaceRemoval.swiftindex 23b785ff..9680b89a 100644--- a/Packages/PeelCore/Sources/PeelCore/Space/SpaceRemoval.swift+++ b/Packages/PeelCore/Sources/PeelCore/Space/SpaceRemoval.swift@@ -223,12 +223,18 @@ public enum SpaceRemoval {if !folder.isMissing { unreadable.append(folder) }return}- let onlyFiles = inside || filesOnly.contains(PathPattern.comparablePath(of: folder))+ let holdsReports = filesOnly.contains(PathPattern.comparablePath(of: folder))+ let onlyFiles = inside || holdsReportsfor child in children {let name = child.lastPathComponentif ProtectedData.isLeftByFinder(name) { continue }if item.leavesMacOSsOwn, SpaceInventory.isMacOSsOwn(name) { continue }if own.contains(Naming.normalized(name)) { continue }+ // macOS files older reports in a folder of its own there, such as `Retired`, which stays.+ if holdsReports, child.isRealFolder {+ sort(child, leaving: [], owner: owner, onlyFiles: true)+ continue+ }if onlyFiles, child.isRealFolder { continue }let app = owner ?? running[Naming.normalized(name)]let listed = owned.filter { fnmatch($0[0], name, FNM_CASEFOLD) == 0 }diff --git a/Packages/PeelCore/Sources/PeelCore/Space/SpaceReport.swift b/Packages/PeelCore/Sources/PeelCore/Space/SpaceReport.swiftindex f2321739..6c7e8820 100644--- a/Packages/PeelCore/Sources/PeelCore/Space/SpaceReport.swift+++ b/Packages/PeelCore/Sources/PeelCore/Space/SpaceReport.swift@@ -483,9 +483,9 @@ public enum SpaceInventory {.filter { !ProtectedData.isApplesName($0.lastPathComponent) }}- /// 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, nothing named for macOS in an area that leaves macOS's own out, and- /// the files of each child folder in place of the folder in an area that keeps its folders.+ /// What an area can offer in its `folders`: every child that is not one of the folders themselves, nothing named+ /// for macOS in an area that leaves macOS's own out, and the files of each child folder in place of the folder+ /// where macOS files its reports into folders and in an area that keeps its folders.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(home: home, root: root).map(PathPattern.comparablePath))@@ -498,15 +498,17 @@ public enum SpaceInventory {}let children = kept.map { folder.appending(path: $0) }.filter { child in!paths.contains(PathPattern.comparablePath(of: child))- && !(filesOnly.contains(PathPattern.comparablePath(of: folder)) && child.isRealFolder)}- guard definition.keepsItsFolders else { return children }+ guard definition.keepsItsFolders || filesOnly.contains(PathPattern.comparablePath(of: folder)) else {+ return children+ }return children.flatMap { child -> [URL] inlet path = child.path(percentEncoded: false)guard child.isRealFolder, let inside = try? FileManager.default.contentsOfDirectory(atPath: path) else {return [child]}- return inside.map { child.appending(path: $0) }.filter { !$0.isRealFolder }+ return inside.filter { !ProtectedData.isLeftByFinder($0) }+ .map { child.appending(path: $0) }.filter { !$0.isRealFolder }}}}diff --git a/Packages/PeelCore/Tests/PeelCoreTests/SpaceInventoryTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/SpaceInventoryTests.swiftindex 21ddc550..88742cf9 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/SpaceInventoryTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/SpaceInventoryTests.swift@@ -455,7 +455,7 @@ struct SpaceInventoryTests {}/// The logs every account shares are measured without what macOS writes there for its own services, and the- /// crash reports without the folders macOS files them into.+ /// crash reports with those in the folders macOS files them into.@Test func findsTheLogsAndReportsEveryAccountSharesWithoutMacOSsOwn() async throws {let directory = try TemporaryDirectory()try directory.file("root/Library/Logs/org.example.tool/run.log", bytes: 8_000)@@ -473,7 +473,7 @@ struct SpaceInventoryTests {#expect(logs.urls.map { $0.pathComponents.suffix(2).joined(separator: "/") } == ["Library/Logs", "Logs/DiagnosticReports",])- #expect(logs.size.isComplete && logs.size.known >= 12_000 && logs.size.known < 50_000)+ #expect(logs.size.isComplete && logs.size.known >= 62_000 && logs.size.known < 100_000)}@Test func findsEveryPlaceOfEveryAreaItKnows() async throws {diff --git a/Packages/PeelCore/Tests/PeelCoreTests/SpaceRemovalTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/SpaceRemovalTests.swiftindex 6e5b9c74..ea94113d 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/SpaceRemovalTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/SpaceRemovalTests.swift@@ -394,7 +394,10 @@ struct SpaceRemovalTests {let plan = await SpaceRemoval.plan(for: shared, environment: environment(directory), running: [:])- #expect(plan.removable.map(\.lastPathComponent).sorted() == ["Example_2026-09-28.ips", "org.example.tool"])+ #expect(+ plan.removable.map(\.lastPathComponent).sorted()+ == ["Example_2026-09-28.ips", "org.example.tool", "panic-full.ips"]+ )#expect(plan.refused.isEmpty)}@@ -416,8 +419,11 @@ struct SpaceRemovalTests {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.isComplete && logs.size.known < 12_000)+ #expect(+ plan.removable.map(\.lastPathComponent).sorted()+ == ["Example_2026-09-28.ips", "org.example.tool", "panic-full.ips"]+ )+ #expect(logs.size.isComplete && logs.size.known >= 12_000 && logs.size.known < 16_000)let removalGuard = RemovalGuard(environment: environment(directory), exclusions: .none)#expect(removalGuard.refusal(of: reports) == .staysItself)}