Skip to content

armgit / peel

Public Imported from GitHub
0

Uninstall Mac apps with every file they leave behind, and see why each belongs. Free up space, fine-tune macOS, and set up Terminal.

Say nothing of the Bluetooth and Trial folders macOS keeps in /Library

Țugui Dragoș61e5f52b024d
diff --git a/Packages/PeelCore/Sources/PeelCore/Leftovers/SystemFolders.swift b/Packages/PeelCore/Sources/PeelCore/Leftovers/SystemFolders.swift
index 79b909d6..14fe46ed 100644
--- a/Packages/PeelCore/Sources/PeelCore/Leftovers/SystemFolders.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Leftovers/SystemFolders.swift
@@ -244,7 +244,9 @@ enum SystemFolders {
/// At the top of a Library, beside the folders Peel searches one by one.
static let library: [String: Proof] = [
+ "Bluetooth": .file("/usr/share/sandbox/bluetoothd.sb", naming: "/Library/Bluetooth"),
"OSAnalytics": .file("/System/Library/Sandbox/Profiles/com.apple.analyticsd.sb", naming: "/Library/OSAnalytics"),
+ "Trial": .file("/System/Library/Sandbox/Profiles/com.apple.triald.sb", naming: "/Library/Trial"),
]
static let webKit: [String: Proof] = [
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/LeftoverScannerTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/LeftoverScannerTests.swift
index 797e3cd8..667561f4 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/LeftoverScannerTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/LeftoverScannerTests.swift
@@ -763,6 +763,21 @@ struct LeftoverScannerTests {
#expect(scan.unreadableLocations.isEmpty)
}
+ @Test(.permissionsHold) func leavesMacOSsOwnFoldersAtTheTopOfALibraryItCannotReadUnsaid() async throws {
+ let directory = try TemporaryDirectory()
+ let folders = ["Bluetooth", "OSAnalytics", "Trial", "Example Software"]
+ for folder in folders {
+ try directory.file("root/Library/\(folder)/state")
+ try directory.setPermissions(0o000, of: "root/Library/\(folder)")
+ }
+ defer { for folder in folders { try? directory.setPermissions(0o755, of: "root/Library/\(folder)") } }
+
+ let scanner = LeftoverScanner(environment: environment(in: directory))
+ let scan = await scanner.scan(tunewell, installedApps: [tunewell])
+
+ #expect(scan.unreadableLocations.map(\.url.lastPathComponent) == ["Example Software"])
+ }
+
@Test(.permissionsHold) func leavesAnotherProgramsFolderItCannotReadUnsaid() async throws {
let directory = try TemporaryDirectory()
try directory.file("home/Library/Caches/org.example.other/cache.db")
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/OrphanScannerTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/OrphanScannerTests.swift
index 6b76fe1e..fa62ba00 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/OrphanScannerTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/OrphanScannerTests.swift
@@ -1702,8 +1702,10 @@ struct OrphanScannerTests {
@Test(.permissionsHold) func saysNothingOfAFolderOfMacOSsOwnAtTheTopOfALibrary() async throws {
let directory = try TemporaryDirectory()
- let folders = ["OSAnalytics", "Example Software"]
+ let folders = ["Bluetooth", "OSAnalytics", "Trial", "Example Software"]
+ try directory.file("root/Library/Bluetooth/Library/Preferences/com.apple.Bluetooth.plist")
try directory.file("root/Library/OSAnalytics/Diagnostics/report.ips")
+ try directory.file("root/Library/Trial/Treatments/state")
try directory.file("root/Library/Example Software/org.example.mixer/settings.json")
for folder in folders {
try directory.setPermissions(0, of: "root/Library/\(folder)")