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.

List in the temporary folder only what came with an app Peel saw go

Țugui Dragoș5f56ca1faf4f
diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md
index 91505ad5..b4b0375d 100644
--- a/ARCHITECTURE.md
+++ b/ARCHITECTURE.md
@@ -396,11 +396,14 @@ macOS asks the user to approve it once. It talks to the app over XPC.
couldn't check, or about one this revision asks nobody about, is dropped, so the app is asked again at the next
round.
- **Orphaned Files.** `OrphanScanner` lists what no installed app claims, under the app Peel saw go when it can name it
- (`AppMemory`), and selects nothing for the person. Once every location is read, the identifiers it found teach their
- apps' names (`learnedNames`), which it looks for in the places an app keeps a folder under its name; a name,
- remembered or learned, is compared without case, spaces, or punctuation (`nameKey`). An app macOS knows on another
- disk that claims something is remembered too (`OrphanScan.appsOnOtherDisks`, `Disks`), so its files stay its own while
- that disk isn't connected, and a link into an app on such a disk is not one into an app that is gone.
+ (`AppMemory`), and selects nothing for the person. Where a name proves nothing by itself, the folders of code macOS
+ loads, which an installer can fill with no app, and the account's temporary folder, where every program writes files
+ named as it likes, it lists only what came with an app Peel saw go (`listsOnlyWhatCameWithAnApp`). Once every location
+ is read, the identifiers it found teach their apps' names (`learnedNames`), which it looks for in the places an app
+ keeps a folder under its name; a name, remembered or learned, is compared without case, spaces, or punctuation
+ (`nameKey`). An app macOS knows on another disk that claims something is remembered too
+ (`OrphanScan.appsOnOtherDisks`, `Disks`), so its files stay its own while that disk isn't connected, and a link into
+ an app on such a disk is not one into an app that is gone.
- **Intel Software.** `IntelInspector` judges by the code itself: what a bundle runs, or a file, is Intel only when
its Mach-O slices are x86_64 alone (`MachOHeader`), and a file found inside an app or beside a printer driver counts
only when it is a program (`MH_EXECUTE`), since a library runs in whatever loads it. It looks at the installed apps
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 278afd36..ca3de3a4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,6 +3,15 @@
Every release of Peel is listed here, newest first. The version is the one About Peel shows, and each entry groups
its changes the way [Keep a Changelog](https://keepachangelog.com/) suggests.
+## 1.3.1 (not released yet)
+
+### Fixed
+
+#### Orphaned Files
+
+- Your account's temporary folder lists only what came with an app Peel saw go, as the plug-in folders do. A file a
+ command-line tool left there under a dotted name was listed as an app's that no app claims.
+
## 1.3.0 (2026-11-04)
### Added
diff --git a/GUIDE.md b/GUIDE.md
index 47fddb59..25be0999 100644
--- a/GUIDE.md
+++ b/GUIDE.md
@@ -119,16 +119,18 @@ Space shows what fills your disk, area by area, and what each area is.
what the app left, or, for the copy macOS keeps of a system extension, by the app macOS's own record names. What
only a name ties to an app is shown and never selected. An app on another disk keeps its files out of the list while
that disk isn't connected, once Orphaned Files has looked with the disk connected. It also lists the files browsers
- keep to start a helper program that is gone. Nothing is selected for you. A system extension's copy can't be selected,
- since only macOS removes it, and its row says how. Peel doesn't list what only a guess could tie to an app, so look
- for it yourself: a folder named only for a maker, such as `Google` in Application Support, a data folder only the
- app's documentation names, such as Tor Browser's `TorBrowser-Data`, a folder named like a gone app while another
- installed app's name holds that name, such as one called Epic beside Epic Games Launcher, and a hidden folder in your
- home named like an app, since one such as `~/.local` is shared by many command-line tools. What only an administrator
- can move, from a place Peel's helper isn't allowed to move it from, is listed apart under Needs an Administrator, with
- how to remove it in Finder, and so is what an uninstall left there, which nothing else would tie to the app once it is
- gone. A kernel extension there says to restart once it is in the Trash and, on a Mac with Apple silicon, how to set
- the startup disk's security back to Full Security if you lowered it to install one.
+ keep to start a helper program that is gone. In your account's temporary folder, where every program writes files
+ named as it likes, it lists only what came with an app it saw go, as it does for plug-ins. Nothing is selected for
+ you. A system extension's copy can't be selected, since only macOS removes it, and its row says how. Peel doesn't list
+ what only a guess could tie to an app, so look for it yourself: a folder named only for a maker, such as `Google` in
+ Application Support, a data folder only the app's documentation names, such as Tor Browser's `TorBrowser-Data`, a
+ folder named like a gone app while another installed app's name holds that name, such as one called Epic beside Epic
+ Games Launcher, and a hidden folder in your home named like an app, since one such as `~/.local` is shared by many
+ command-line tools. What only an administrator can move, from a place Peel's helper isn't allowed to move it from, is
+ listed apart under Needs an Administrator, with how to remove it in Finder, and so is what an uninstall left there,
+ which nothing else would tie to the app once it is gone. A kernel extension there says to restart once it is in the
+ Trash and, on a Mac with Apple silicon, how to set the startup disk's security back to Full Security if you lowered it
+ to install one.
- **Developer:** caches of developer tools, editors, browsers, and AI models. Nothing is selected for you, and Select
Recommended passes by what you may want again; toolchains or anything holding an account are never listed.
- **Build Artifacts:** what builds left in your projects, like `node_modules`, `DerivedData`, or `target`, each only
diff --git a/Packages/PeelCore/Sources/PeelCore/Orphans/OrphanScanner.swift b/Packages/PeelCore/Sources/PeelCore/Orphans/OrphanScanner.swift
index 2b7e99cd..a81b6659 100644
--- a/Packages/PeelCore/Sources/PeelCore/Orphans/OrphanScanner.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Orphans/OrphanScanner.swift
@@ -781,9 +781,14 @@ public struct OrphanScanner: Sendable {
}
}
- /// Whether a plug-in or a framework came with an app Peel saw go: its identifier is that app's, extends it, or
- /// is its maker's. An installer can put one in place with no app at all, and its date does not move when it is
- /// used, so nothing else says it was left behind.
+ /// Where a name proves nothing by itself, so only what came with an app Peel saw go is listed: the folders of
+ /// code macOS loads, which an installer can fill with no app, and the temporary folder, where every program that
+ /// runs writes files named as it likes.
+ static func listsOnlyWhatCameWithAnApp(_ kind: SearchLocation.Kind) -> Bool {
+ kind.isLoadedCode || kind == .temporaryItems
+ }
+
+ /// Whether an item came with an app Peel saw go: its identifier is that app's, extends it, or is its maker's.
static func cameWithAnAppThatLeft(_ identifier: String, goneApps: [String]) -> Bool {
let plugIn = identifier.lowercased()
let maker = Identifier.vendor(of: plugIn)
@@ -856,7 +861,7 @@ public struct OrphanScanner: Sendable {
ownership: ownership,
jobs: jobs,
goneBundles: goneBundles,
- cameWithOneOf: location.kind.isLoadedCode ? goneApps : nil
+ cameWithOneOf: listsOnlyWhatCameWithAnApp(location.kind) ? goneApps : nil
)
if listing == .notListed {
listing = await goneApp(named: url, kind: location.kind, goneNames: goneNames, ownership: ownership)
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/OrphanScannerTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/OrphanScannerTests.swift
index fa34e842..455476e4 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/OrphanScannerTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/OrphanScannerTests.swift
@@ -1302,16 +1302,40 @@ struct OrphanScannerTests {
try directory.file("var/T/tomcat.8080.10018690101673077448/work/Tomcat/localhost/ROOT/SESSIONS.ser")
try directory.file("var/T/tomcat.8080.10054962961815905490/work/Tomcat/localhost/ROOT/SESSIONS.ser")
try directory.file("var/T/com.gone.app/cache.db")
+
+ let scan = await scannerOfTheTemporaryFolder(in: directory)
+ .scan(installedApps: installed, remembered: [goneApp])
+
+ #expect(scan.groups.map(\.identifier) == ["com.gone.app"])
+ }
+
+ @Test func listsInTheTemporaryFolderOnlyWhatCameWithAnAppPeelSawGo() async throws {
+ let directory = try TemporaryDirectory()
+ try directory.file("var/T/tool.registry.545355")
+ try directory.file("var/T/com.unseen.app/cache.db")
+ try directory.file("var/T/com.gone.app/cache.db")
+ try directory.file("var/T/com.gone.app.helper/state.db")
+
+ let scan = await scannerOfTheTemporaryFolder(in: directory)
+ .scan(installedApps: installed, remembered: [goneApp])
+
+ #expect(scan.groups.map(\.identifier) == ["com.gone.app"])
+ #expect(
+ Set(scan.groups.flatMap(\.items).map(\.url.lastPathComponent)) == ["com.gone.app", "com.gone.app.helper"]
+ )
+ }
+
+ private let goneApp = RememberedApp(
+ bundleIdentifier: "com.gone.app", name: "Gone", teamIdentifier: nil, lastSeen: .now, lastPath: "/Applications/Gone.app"
+ )
+
+ private func scannerOfTheTemporaryFolder(in directory: borrowing TemporaryDirectory) -> OrphanScanner {
let environment = SearchEnvironment(
homeDirectory: directory.url.appending(path: "home", directoryHint: .isDirectory),
rootDirectory: directory.url.appending(path: "root", directoryHint: .isDirectory),
userTemporaryDirectory: directory.url.appending(path: "var/T", directoryHint: .isDirectory)
)
-
- let scan = await OrphanScanner(environment: environment, isRegisteredApp: { _ in false }, systemApps: [])
- .scan(installedApps: installed)
-
- #expect(scan.groups.map(\.identifier) == ["com.gone.app"])
+ return OrphanScanner(environment: environment, isRegisteredApp: { _ in false }, systemApps: [])
}
@Test func findsWhatAMacCatalystBuildLeft() async throws {
@@ -1979,7 +2003,7 @@ struct OrphanScannerTests {
)
let scan = await OrphanScanner(environment: environment, isRegisteredApp: { _ in false }, systemApps: [])
- .scan(installedApps: installed)
+ .scan(installedApps: installed, remembered: [goneApp])
#expect(scan.groups.flatMap(\.items).map(\.url.lastPathComponent) == ["com.gone.app"])
}