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
Uninstalling lists an app's file system in /Library/Filesystems, never selected
Țugui Dragoșa5858fb3f06e
diff --git a/Packages/PeelCore/Sources/PeelCore/Leftovers/LeftoverMatcher.swift b/Packages/PeelCore/Sources/PeelCore/Leftovers/LeftoverMatcher.swiftindex 7e88379d..f3a97afe 100644--- a/Packages/PeelCore/Sources/PeelCore/Leftovers/LeftoverMatcher.swift+++ b/Packages/PeelCore/Sources/PeelCore/Leftovers/LeftoverMatcher.swift@@ -140,7 +140,7 @@ struct LeftoverMatcher: Sendable {private static let plugInExtensions = [".component", ".vst3", ".vst", ".clap", ".driver", ".plugin", ".webplugin", ".bundle", ".mailbundle",".prefPane", ".qlgenerator", ".saver", ".qtz", ".mdimporter", ".service", ".workflow", ".colorPicker",- ".menu", ".inputmethod", ".app", ".aaxplugin", ".dictionary", ".action", ".kext",+ ".menu", ".inputmethod", ".app", ".aaxplugin", ".dictionary", ".action", ".kext", ".fs",]static func withoutPlugInExtension(_ fileName: String) -> String {diff --git a/Packages/PeelCore/Sources/PeelCore/Leftovers/SearchLocation.swift b/Packages/PeelCore/Sources/PeelCore/Leftovers/SearchLocation.swiftindex 92af01c7..10995d13 100644--- a/Packages/PeelCore/Sources/PeelCore/Leftovers/SearchLocation.swift+++ b/Packages/PeelCore/Sources/PeelCore/Leftovers/SearchLocation.swift@@ -125,14 +125,15 @@ public struct SearchEnvironment: Sendable {/// The first folder of every Library path scanned as a location of its own, such as `Preferences`. The top of/// a Library never offers one of these whole: they are looked inside, never moved.static let libraryEntriesScannedElsewhere = Set(- ((userEntries + localEntries).map(\.1) + Plugins.folders.map(\.0) + [kernelExtensions]).map { name in+ ((userEntries + localEntries).map(\.1) + Plugins.folders.map(\.0) + systemCodeFolders).map { name inString(name.prefix { $0 != "/" })})- /// Where a driver's kernel extensions stay in `/Library`. They are searched like plug-ins, named for what they- /// do, but the helper does not serve this folder, so what is found there is listed and never moved.- static let kernelExtensions = "Extensions"+ /// Where a driver's kernel extensions and a file system's bundles stay in `/Library`. They are searched like+ /// plug-ins, named for what they do, but the helper does not serve these folders, so what is found there is+ /// listed and never moved.+ static let systemCodeFolders = ["Extensions", "Filesystems"]public var locations: [SearchLocation] {let userLibrary = homeDirectory.appending(path: "Library", directoryHint: .isDirectory)@@ -144,9 +145,9 @@ public struct SearchEnvironment: Sendable {locations += [userLibrary, localLibrary].flatMap { library inPlugins.folders.map { SearchLocation(kind: .plugIns, url: library.appending(path: $0.0, directoryHint: .isDirectory)) }}- locations.append(SearchLocation(- kind: .plugIns, url: localLibrary.appending(path: Self.kernelExtensions, directoryHint: .isDirectory)- ))+ locations += Self.systemCodeFolders.map {+ SearchLocation(kind: .plugIns, url: localLibrary.appending(path: $0, directoryHint: .isDirectory))+ }if let userCacheDirectory {locations.append(SearchLocation(kind: .caches, url: userCacheDirectory))}diff --git a/Packages/PeelCore/Tests/PeelCoreTests/LeftoverScannerTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/LeftoverScannerTests.swiftindex 64d0ca30..855d8081 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/LeftoverScannerTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/LeftoverScannerTests.swift@@ -945,6 +945,30 @@ struct LeftoverScannerTests {#expect(scan.leftovers.count == 1, "the kext was reached twice or its folder was offered")}+ /// A file system an app's package installed stays in `/Library/Filesystems` after the app goes, and is listed the+ /// same way: found by the identifier it declares, never selected, since the helper does not serve that folder.+ @Test(.permissionsHold) func listsTheAppsFileSystemWithoutEverSelectingIt() async throws {+ let directory = try TemporaryDirectory()+ let app = InstalledApp(+ url: URL(filePath: "/Applications/Hexachord.app"),+ bundleIdentifier: "org.example.hexachord",+ name: "Hexachord"+ )+ let info = try PropertyListSerialization.data(+ fromPropertyList: ["CFBundleIdentifier": "org.example.hexachord.filesystem"], format: .xml, options: 0+ )+ try info.write(to: directory.file("root/Library/Filesystems/hexfs.fs/Contents/Info.plist"))+ try directory.setPermissions(0o555, of: "root/Library/Filesystems")+ defer { try? directory.setPermissions(0o755, of: "root/Library/Filesystems") }++ let found = await LeftoverScanner(environment: environment(in: directory)).scan(app, installedApps: [app])+ let scan = found.holdingBack(beyond: HelperReach(environment: environment(in: directory)), leaving: app.url)++ let fileSystem = try #require(scan.leftovers.first { $0.url.lastPathComponent == "hexfs.fs" })+ #expect(fileSystem.match.heldBack == .beyondTheHelper)+ #expect(scan.leftovers.count == 1, "the file system was reached twice or its folder was offered")+ }+/// Apple: "The system automatically uninstalls any system extensions when the user deletes the corresponding/// app." The copy macOS activated in `/Library/SystemExtensions` is its own to remove, so it is never listed.@Test func neverListsASystemExtensionMacOSRemovesWithItsApp() async throws {