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
List an excluded app's background jobs, marked and left alone
Țugui Dragoș394ba777fc5b
diff --git a/AGENTS.md b/AGENTS.mdindex 2816f9fe..0f076492 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -112,7 +112,8 @@ checked by hand. If a change makes one of them fail, the rule is right and the cselected in two places, since its tool clones it again: inside Swift Package Manager's `.build`, which it tags as acache (`CACHEDIR.TAG`), and inside a cache on the Developer page; a tag alone never makes a repository selectable(`Definition.remakesItsClones`).-- **The user's exclusions reach every scanner**, so an excluded item never appears in the first place.+- **The user's exclusions reach every scanner**, so an excluded item never appears in the first place, but for an+ excluded app's jobs, which Background Items lists marked, acting on none, since that tab says what runs.- **What a file says about itself is anyone's word.** Any program can write a launch job, an app's Info.plist, or oneof Peel's own records, so a program path that holds a NUL names no program, an app's name goes into a pattern onlyquoted, and a record Peel kept is believed only as a scan believes what it finds (`LeftForAnAdministrator`).diff --git a/ARCHITECTURE.md b/ARCHITECTURE.mdindex d4c31d5c..56e545d2 100644--- a/ARCHITECTURE.md+++ b/ARCHITECTURE.md@@ -229,7 +229,8 @@ A handful of ideas carry most of the weight. Each is enforced in one place and tthe Trash would take it from those devices too. It looks a level or two inside a folder for a library, a wallet, orwork kept only in a cache, and refuses a folder holding a folder macOS won't let Peel list, unless only the helper canmove it, which looks inside as root (`ProtectedData.Finding`).-- **Exclusions everywhere.** The user's exclusions reach every scanner, so an excluded item never appears, and+- **Exclusions everywhere.** The user's exclusions reach every scanner, so an excluded item never appears (but an+ excluded app's jobs, which Background Items lists marked and acts on none of, since that tab says what runs), anda folder with something excluded inside is never moved, nor one Peel can't look into for an excluded app, since thehelper knows nothing of the exclusions.- **Unknown stays unknown.** A size that couldn't be measured, a list a tool didn't give, an answer that didn'tdiff --git a/GUIDE.md b/GUIDE.mdindex 0a18b496..9889238a 100644--- a/GUIDE.md+++ b/GUIDE.md@@ -333,10 +333,10 @@ It sets up the command line as well:and keeps the latest 20,000 items, fewer when their paths are very long, saying once how many older removals itno longer lists, and Peel moves no more at once than History can keep. While Peel stays open, Undo in the Editmenu puts back the last removal you made in it.-- **Exclusions:** files, folders, and apps Peel must never touch. An excluded app still appears in Applications, but- Peel won't offer to remove or reset it, and leaves out of every page the folders named exactly with its identifier,- such as its caches, and an update it downloaded; to keep its other files, such as plug-ins or a folder named after- it, exclude them too. Add them in+- **Exclusions:** files, folders, and apps Peel must never touch. An excluded app still appears in Applications, and+ its jobs in Background Items, but Peel won't offer to remove or reset it or act on its jobs, and leaves out of every+ page the folders named exactly with its identifier, such as its caches, and an update it downloaded; to keep its+ other files, such as plug-ins or a folder named after it, exclude them too. Add them inSettings > Exclusions, or Control-click a row and choose Exclude from Peel. In Orphaned Files, Control-click agroup and choose This Belongs To, and Peel stops listing it while the app you chose is installed.diff --git a/Localization/Peel/Localizable.xcstrings b/Localization/Peel/Localizable.xcstringsindex 4ec93bdf..58fa5766 100644--- a/Localization/Peel/Localizable.xcstrings+++ b/Localization/Peel/Localizable.xcstrings@@ -214339,6 +214339,113 @@}}},+ "You excluded the app it is for, so Peel lists it and doesn’t start, stop, enable, disable, or remove it here." : {+ "comment" : "On a background job’s page, under the title Excluded in Settings: the job belongs to an app the person excluded. It stays listed, since the page says what runs in the background, and Peel changes nothing of it.",+ "localizations" : {+ "cs" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Aplikaci, ke které patří, jste vyloučili, takže ji tu Peel uvádí, ale nespouští, nezastavuje, nezapíná, nevypíná ani neodstraňuje."+ }+ },+ "de" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Du hast die App ausgeschlossen, zu der es gehört, daher führt Peel es zwar auf, startet, stoppt, aktiviert, deaktiviert oder entfernt es hier aber nicht."+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Has excluido la app a la que pertenece, así que Peel lo muestra, pero aquí no lo inicia, no lo detiene, no lo activa, no lo desactiva ni lo elimina."+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Vous avez exclu l’app à laquelle il est destiné : Peel le liste donc, sans le démarrer, l’arrêter, l’activer, le désactiver ni le supprimer ici."+ }+ },+ "it" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Hai escluso l’app a cui appartiene, quindi Peel lo elenca, ma qui non lo avvia, non lo interrompe, non lo abilita, non lo disabilita e non lo rimuove."+ }+ },+ "ja" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "このジョブが属するアプリを除外したため、Peelはこれを一覧に表示しますが、ここでは開始、停止、有効化、無効化、ゴミ箱への移動を行いません。"+ }+ },+ "ko" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "사용자가 이 항목이 속한 앱을 제외했으므로, Peel은 이 항목을 목록에 표시하지만 여기에서 시작, 중단, 활성화, 비활성화 또는 제거하지 않습니다."+ }+ },+ "nl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Je hebt de bijbehorende app uitgesloten, dus Peel toont het wel, maar start het hier niet, stopt het niet, schakelt het niet in of uit en verwijdert het niet."+ }+ },+ "pl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Ta rzecz należy do wykluczonej przez Ciebie aplikacji, więc Peel ją wyświetla, ale jej tutaj nie uruchamia, nie zatrzymuje, nie włącza, nie wyłącza ani nie przenosi do Kosza."+ }+ },+ "pt" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "O app dele está nas suas exclusões, então o Peel o lista, mas não o inicia, não o interrompe, não o ativa, não o desativa nem o remove aqui."+ }+ },+ "ro" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Ați exclus aplicația căreia îi aparține, așa că Peel îl listează, dar nu îl pornește, nu îl oprește, nu îl activează, nu îl dezactivează și nu îl elimină de aici."+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Вы исключили приложение, к которому он относится, поэтому Peel показывает его в списке, но здесь не запускает, не останавливает, не включает, не выключает и не удаляет его."+ }+ },+ "sv" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Du har undantagit appen som det hör till, så Peel listar det men varken startar, stoppar, aktiverar, avaktiverar eller tar bort det här."+ }+ },+ "tr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Ait olduğu uygulamayı hariç tuttunuz, bu yüzden Peel onu listeler ama burada başlatmaz, durdurmaz, etkinleştirmez, etkisizleştirmez veya kaldırmaz."+ }+ },+ "uk" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Ви додали до винятків програму, якій належить цей елемент, тож Peel показує його, але тут не запускає, не зупиняє, не вмикає, не вимикає й не вилучає."+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "你已排除它所属的App,因此Peel会列出它,但不会在此处启动、停止、启用、停用或移除它。"+ }+ },+ "zh-Hant" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "你已排除它所屬的App,因此Peel會列出它,但不會在這裡啟動、停止、啟用、停用或移除它。"+ }+ }+ }+ },"You lose the quick way to type accented letters." : {"localizations" : {"cs" : {diff --git a/Packages/PeelCore/Sources/PeelCore/Apps/IntelInspector.swift b/Packages/PeelCore/Sources/PeelCore/Apps/IntelInspector.swiftindex d94a61aa..faa4415e 100644--- a/Packages/PeelCore/Sources/PeelCore/Apps/IntelInspector.swift+++ b/Packages/PeelCore/Sources/PeelCore/Apps/IntelInspector.swift@@ -210,7 +210,7 @@ public enum IntelInspector {// named on its row.var listed = findings.map { PathPattern.comparablePath(of: $0.url) }unreadable += backgroundItems.unreadableFolders- for item in backgroundItems.items where !Task.isCancelled {+ for item in backgroundItems.items where !Task.isCancelled && !item.isExcluded {// Peel can't tell what a job file it can't read runs, which may be Intel only.if item.isClosedToPeel, item.program == nil, let plist = item.plistURL {unreadable.append(plist)diff --git a/Packages/PeelCore/Sources/PeelCore/BackgroundItems/BackgroundItem.swift b/Packages/PeelCore/Sources/PeelCore/BackgroundItems/BackgroundItem.swiftindex 8b633c6e..fe3e8473 100644--- a/Packages/PeelCore/Sources/PeelCore/BackgroundItems/BackgroundItem.swift+++ b/Packages/PeelCore/Sources/PeelCore/BackgroundItems/BackgroundItem.swift@@ -70,6 +70,8 @@ public struct BackgroundItem: Sendable, Hashable, Identifiable {/// True for a job launchd runs from a file no longer on disk, removed while it was loaded: launchd forgets it at/// the next logout or restart, and nothing loads it again.public var isFileGone = false+ /// True for a job of an app the person excluded in Settings, which Peel lists and never acts on.+ public var isExcluded = falsepublic var anotherFileIsLoaded = falsepublic var isOwnerInstalled: Bool { ownerURL != nil }@@ -99,11 +101,11 @@ public struct BackgroundItem: Sendable, Hashable, Identifiable {declaresAnAppleLabel || SystemDaemons.shipped.contains(label) || SystemAgents.shipped.contains(label)}- /// True when Peel may start, stop, enable and disable the job: never under a label of macOS or for a system- /// extension, an agent only under a label `launchctl` reads whole, and a daemon only under a label the helper- /// takes, which also leaves out the helper itself.+ /// True when Peel may start, stop, enable and disable the job: never under a label of macOS, for a system+ /// extension or for an excluded app, an agent only under a label `launchctl` reads whole, and a daemon only under a+ /// label the helper takes, which also leaves out the helper itself.public var canBeControlled: Bool {- !usesALabelOfMacOS && !isSystemExtension+ !usesALabelOfMacOS && !isSystemExtension && !isExcluded&& (requiresPrivileges ? PrivilegedPathPolicy.allowsDaemon(label) : isReadWholeByLaunchctl)}@@ -132,5 +134,7 @@ public struct BackgroundItem: Sendable, Hashable, Identifiable {/// started again from here.public var isSeenOnlyWhileLoaded: Bool { source == .app || source == .otherFile }- public var canMoveToTrash: Bool { !isSeenOnlyWhileLoaded && plistURL != nil && !usesALabelOfMacOS }+ public var canMoveToTrash: Bool {+ !isSeenOnlyWhileLoaded && plistURL != nil && !usesALabelOfMacOS && !isExcluded+ }}diff --git a/Packages/PeelCore/Sources/PeelCore/BackgroundItems/BackgroundItems.swift b/Packages/PeelCore/Sources/PeelCore/BackgroundItems/BackgroundItems.swiftindex f029fe97..a1baf80d 100644--- a/Packages/PeelCore/Sources/PeelCore/BackgroundItems/BackgroundItems.swift+++ b/Packages/PeelCore/Sources/PeelCore/BackgroundItems/BackgroundItems.swift@@ -113,9 +113,7 @@ public enum BackgroundItems {items += disabledJobs(in: loaded, listed: items, ownership: ownership)return Scan(- items: items- .filter { $0.ownerBundleIdentifier.map(exclusions.excludes(bundleIdentifier:)) != true }- .sorted { $0.label.localizedStandardCompare($1.label) == .orderedAscending },+ items: rows(items, exclusions: exclusions),unanswered: undeclared.unanswered,unreadableFolders: unlisted.map(\.refused).reduce(into: []) { if !$0.contains($1) { $0.append($1) } })@@ -123,6 +121,18 @@ public enum BackgroundItems {/// The rows, each job launchd loaded from a file Peel can't read in the place of that file's row, with the file's/// folder as its source; then the other loaded jobs.+ /// The rows in the page's order. A job of an app the person excluded stays listed, marked so: the tab says what+ /// runs in the background, and Peel acts on none of it.+ static func rows(_ items: [BackgroundItem], exclusions: Exclusions) -> [BackgroundItem] {+ items+ .map { item in+ var item = item+ item.isExcluded = item.ownerBundleIdentifier.map(exclusions.excludes(bundleIdentifier:)) == true+ return item+ }+ .sorted { $0.label.localizedStandardCompare($1.label) == .orderedAscending }+ }+private static func jobFolders(in environment: SearchEnvironment) -> [(folder: URL, kind: BackgroundItem.Kind, source: BackgroundItem.Source)] {diff --git a/Packages/PeelCore/Tests/PeelCoreTests/BackgroundItemActionsTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/BackgroundItemActionsTests.swiftindex 309c0ce1..586a5c82 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/BackgroundItemActionsTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/BackgroundItemActionsTests.swift@@ -27,6 +27,28 @@ struct BackgroundItemActionsTests {#expect(try !#require(JobDefinition(["Label": "a"])).loadsInTheBackground)}+ /// The tab says what runs in the background: a job of an app the person excluded is listed, marked so, and Peel+ /// acts on none of it.+ @Test func listsAnExcludedAppsJobWithoutActingOnIt() {+ func job(_ label: String, owner: String) -> BackgroundItem {+ BackgroundItem(+ label: label, kind: .agent, source: .userLibrary,+ plistURL: URL(filePath: "/Users/me/Library/LaunchAgents/\(label).plist"), program: "/Applications/x",+ runsAtLoad: true, keepsAlive: true, ownerBundleIdentifier: owner, ownerName: nil,+ ownerURL: nil, isOrphan: false, state: .running(pid: 42), isDisabled: false+ )+ }+ let rows = BackgroundItems.rows(+ [job("org.example.other.agent", owner: "org.example.other"), job("org.example.guard.agent", owner: "org.example.guard")],+ exclusions: Exclusions(bundleIdentifiers: ["org.example.guard"])+ )++ #expect(rows.map(\.label) == ["org.example.guard.agent", "org.example.other.agent"])+ #expect(rows.map(\.isExcluded) == [true, false])+ #expect(rows.map(\.canBeControlled) == [false, true])+ #expect(rows.map(\.canMoveToTrash) == [false, true])+ }+@Test func knowsAJobItsGoneAppLeftLoaded() {let job = { (source: BackgroundItem.Source, owner: URL?, isOrphan: Bool, program: String?) inBackgroundItem(diff --git a/Packages/PeelCore/Tests/PeelCoreTests/ExclusionsTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/ExclusionsTests.swiftindex 086bb860..6514dd09 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/ExclusionsTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/ExclusionsTests.swift@@ -597,7 +597,8 @@ struct ExclusionsReachEveryScannerTests {}/// An app excluded by identifier takes its background items with it: they are not listed, so not stopped.- @Test func theBackgroundItemsOfAnExcludedAppAreNotListed() async throws {+ /// Background Items says what runs, so an excluded app's jobs stay listed there, and Peel acts on none of them.+ @Test func theBackgroundItemsOfAnExcludedAppAreListedAndLeftAlone() async throws {let directory = try TemporaryDirectory()try directory.file("home/Library/LaunchAgents/com.example.keepme.updater.plist", contents: Data("""<?xml version="1.0" encoding="UTF-8"?>@@ -614,7 +615,8 @@ struct ExclusionsReachEveryScannerTests {).items#expect(listed.first { $0.label == "com.example.keepme.updater" }?.ownerBundleIdentifier == "com.example.KeepMe")- #expect(!kept.contains { $0.label == "com.example.keepme.updater" })+ let excluded = try #require(kept.first { $0.label == "com.example.keepme.updater" })+ #expect(excluded.isExcluded && !excluded.canBeControlled && !excluded.canMoveToTrash)}@Test func aPluginTheUserExcludedIsNotListed() async throws {diff --git a/Peel/Views/BackgroundItems/BackgroundItemDetailView.swift b/Peel/Views/BackgroundItems/BackgroundItemDetailView.swiftindex 1229af7b..362fec67 100644--- a/Peel/Views/BackgroundItems/BackgroundItemDetailView.swift+++ b/Peel/Views/BackgroundItems/BackgroundItemDetailView.swift@@ -106,6 +106,19 @@ struct BackgroundItemDetailView: View {}}+ if item.isExcluded {+ Section {+ Notice(+ title: Text("Excluded in Settings"),+ detail: Text("You excluded the app it is for, so Peel lists it and doesn’t start, stop, enable, disable, or remove it here."),+ kind: .note+ ) {+ Button("Open Exclusions in Settings…") { SettingsPane.exclusions.open(with: openSettings) }+ }+ .padding(.vertical, 6)+ }+ }+if item.declaresAnAppleLabel {Section {Notice(diff --git a/Peel/Views/BackgroundItems/BackgroundItemList.swift b/Peel/Views/BackgroundItems/BackgroundItemList.swiftindex 92b7e60e..3d059afa 100644--- a/Peel/Views/BackgroundItems/BackgroundItemList.swift+++ b/Peel/Views/BackgroundItems/BackgroundItemList.swift@@ -247,6 +247,12 @@ private struct BackgroundItemRow: View {.foregroundStyle(.secondary).lineLimit(1)}+ if item.isExcluded {+ Text("Excluded in Settings")+ .font(.caption)+ .foregroundStyle(.secondary)+ .lineLimit(1)+ }if item.unusualCommand != nil {StatusLabel(title: Text("Unusual command")).font(.caption)diff --git a/SAFETY.md b/SAFETY.mdindex b522b053..8985d3b7 100644--- a/SAFETY.md+++ b/SAFETY.md@@ -551,7 +551,9 @@ It holds in both directions. A folder with something excluded inside it is neverexcluded file would go with it: an app's leftover like that is shown with the reason and can't be selected, andthe other tools leave it out. An excluded app still appears in Applications, so you can see it, but gets noremoval plan and no reset, in the app and in `peel`, and nothing moves it to the Trash or puts it back, from any-page and whatever its bundle is called, nor a folder that holds it a level or two down. A folder named with its+page and whatever its bundle is called, nor a folder that holds it a level or two down. Its jobs stay listed in+Background Items, which says what runs, marked as excluded, and Peel doesn't start, stop, disable, or remove them.+A folder named with itsidentifier, such as its caches or its container, is left out of every page and never moved, nor is a folder holdingone a level or two down, nor one with a folder inside that macOS won't let Peel list, since such a folder may be inthere: that holds even for what only the helper could move, as the helper knows nothing of your exclusions. Its installer