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
Say nothing of macOS's push service folder among the unreadable ones
Țugui Dragoș5a72c5821d12
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 4509a808..ef41734c 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -186,6 +186,9 @@ its changes the way [Keep a Changelog](https://keepachangelog.com/) suggests.- The folders a Spring Boot server's embedded Tomcat leaves in the temporary folder, named `tomcat.` with the port and anumber, are no longer taken for apps' files, each listed as a gone app of its own.+- The folder macOS keeps for its push notification service, `ApplePushService` in `/Library/Application Support`, is no+ longer named among the folders Peel couldn't look inside, in Orphaned Files or on an app's page: only macOS can read+ it, and no other app's files are there.- Lists what an app with a tool's identifier left while another such app is installed.#### Orphaned Files and Storagediff --git a/Packages/PeelCore/Sources/PeelCore/Leftovers/NestedSearch.swift b/Packages/PeelCore/Sources/PeelCore/Leftovers/NestedSearch.swiftindex 21d4903a..5bc5062a 100644--- a/Packages/PeelCore/Sources/PeelCore/Leftovers/NestedSearch.swift+++ b/Packages/PeelCore/Sources/PeelCore/Leftovers/NestedSearch.swift@@ -65,7 +65,8 @@ enum NestedSearch {} catch CocoaError.fileReadNoSuchFile {continue} catch {- if !ProtectedData.isApplesName(folder.lastPathComponent) {+ let name = folder.lastPathComponent+ if !ProtectedData.isApplesName(name), !SystemSupportFolders.isMacOSs(name) {findings.unreadable.append(folder)}continuediff --git a/Packages/PeelCore/Sources/PeelCore/Leftovers/SystemSupportFolders.swift b/Packages/PeelCore/Sources/PeelCore/Leftovers/SystemSupportFolders.swiftnew file mode 100644index 00000000..34637325--- /dev/null+++ b/Packages/PeelCore/Sources/PeelCore/Leftovers/SystemSupportFolders.swift@@ -0,0 +1,15 @@+import Foundation++/// What macOS keeps in an Application Support folder for its own services, each name with the part of the sealed+/// system that carries it, as `SystemCaches` does for caches.+enum SystemSupportFolders {+ static let named: [String: String] = [+ "ApplePushService": "/System/Library/PrivateFrameworks/ApplePushService.framework",+ ]++ private static let lowercasedNames = Set(named.keys.map { $0.lowercased() })++ static func isMacOSs(_ name: String) -> Bool {+ lowercasedNames.contains(name.lowercased())+ }+}diff --git a/Packages/PeelCore/Tests/PeelCoreTests/OrphanScannerTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/OrphanScannerTests.swiftindex 9ba260b2..c882fcd8 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/OrphanScannerTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/OrphanScannerTests.swift@@ -1255,6 +1255,25 @@ struct OrphanScannerTests {#expect(!scan.needsFullDiskAccess)}+ @Test(.permissionsHold) func saysNothingOfAFolderOfMacOSsOwnItCouldNotRead() async throws {+ let directory = try TemporaryDirectory()+ let folders = ["ApplePushService", "Example Software"]+ try directory.file("root/Library/Application Support/ApplePushService/aps.db")+ try directory.file("root/Library/Application Support/Example Software/org.example.mixer/settings.json")+ for folder in folders {+ try directory.setPermissions(0, of: "root/Library/Application Support/\(folder)")+ }+ defer {+ for folder in folders {+ try? directory.setPermissions(0o755, of: "root/Library/Application Support/\(folder)")+ }+ }++ let scan = await scanner(in: directory).scan(installedApps: installed)++ #expect(scan.unreadableLocations.map(\.url.lastPathComponent) == ["Example Software"])+ }+@Test func saysWhereItStoppedLookingInsideFolders() async throws {let directory = try TemporaryDirectory()try directory.file("home/Library/Application Support/Vendor One/notes.txt")diff --git a/Packages/PeelCore/Tests/PeelCoreTests/SystemSupportFoldersTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/SystemSupportFoldersTests.swiftnew file mode 100644index 00000000..64eec896--- /dev/null+++ b/Packages/PeelCore/Tests/PeelCoreTests/SystemSupportFoldersTests.swift@@ -0,0 +1,12 @@+import Foundation+@testable import PeelCore+import Testing++struct SystemSupportFoldersTests {+ @Test func everyNameIsCarriedByAPartOfTheSealedSystem() {+ for (name, source) in SystemSupportFolders.named {+ #expect(FileManager.default.fileExists(atPath: source), "\(name): \(source)")+ #expect(URL(filePath: source).deletingPathExtension().lastPathComponent == name, "\(name): \(source)")+ }+ }+}