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
Take an uninstalled app's icon out of the Dock from peel too
Țugui Dragoș5b3e66d69904
diff --git a/Packages/PeelCore/Sources/PeelCommandLine/Commands/AppCommands.swift b/Packages/PeelCore/Sources/PeelCommandLine/Commands/AppCommands.swiftindex cce8a773..0d35bafc 100644--- a/Packages/PeelCore/Sources/PeelCommandLine/Commands/AppCommands.swift+++ b/Packages/PeelCore/Sources/PeelCommandLine/Commands/AppCommands.swift@@ -242,6 +242,9 @@ struct UninstallCommand: AsyncParsableCommand {@Flag(help: "Show what would move without moving anything.")var dryRun = false+ @Flag(help: "Leave the app's icon in the Dock. Without it, the icon comes out once the app is in the Trash, and goes back where it was if the app is put back.")+ var keepInDock = false+@Flag(name: .shortAndLong, help: "Don't ask for confirmation.")var yes = false@@ -372,6 +375,17 @@ struct UninstallCommand: AsyncParsableCommand {}}+ /// Whether the app's icon comes out of the Dock: once the app itself is in the Trash, unless `--keep-in-dock`.+ static func takesOutDockIcon(of app: InstalledApp, after result: TrashResult, keeping: Bool) -> Bool {+ !keeping && result.trashed.contains { $0.originalURL == app.url }+ }++ /// What the plan says about the app's icon in the Dock, which History puts back with the app.+ static func dockNote(for app: InstalledApp, isInTheDock: Bool, keeping: Bool) -> String? {+ guard isInTheDock, !keeping else { return nil }+ return "Peel takes \(Output.plain(app.name))'s icon out of the Dock once it is in the Trash, and puts it back if you put the app back. Add --keep-in-dock to leave it."+ }+/// What the removal does that the Trash can't bring back, said before the question.static func warnings(moving urls: Set<URL>, of app: InstalledApp, resettingPrivacy: Bool) -> [String] {var warnings: [String] = []@@ -488,7 +502,9 @@ struct UninstallCommand: AsyncParsableCommand {}// With `--json`, standard output is the report alone, so the warnings go where the notes go.let warnings = Self.warnings(moving: Set(plan.moving.map(\.url)), of: target, resettingPrivacy: resetPrivacy)- warnings.forEach(output.json ? Output.note : Output.line)+ let isInTheDock = !(await DockTiles().holding([target.url])).isEmpty+ let dock = Self.dockNote(for: target, isInTheDock: isInTheDock, keeping: keepInDock)+ (warnings + (dock.map { [$0] } ?? [])).forEach(output.json ? Output.note : Output.line)Self.whatStays(plan, app: target, homebrew: homebrew, scan: uninstallation.scan).forEach(Output.note)guard !dryRun else {@@ -513,6 +529,9 @@ struct UninstallCommand: AsyncParsableCommand {return (reset, result, await plan.record(result, from: target.name))}let privacy = reset.map { Self.privacyOutcome($0, app: target, after: result) }+ if isInTheDock, Self.takesOutDockIcon(of: target, after: result, keeping: keepInDock) {+ _ = await DockTiles().takeOut([target.url])+ }if output.json {let report = Self.report(app: target, plan: plan, result: result, privacy: reset, unreadable: unreadable)diff --git a/Packages/PeelCore/Tests/PeelCoreTests/CommandLineTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/CommandLineTests.swiftindex 5f8604f4..df4c5a23 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/CommandLineTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/CommandLineTests.swift@@ -58,6 +58,25 @@ struct CommandLineTests {#expect(UninstallCommand.warnings(moving: [], of: mullvad, resettingPrivacy: false).isEmpty)}+ /// Like the app, `peel uninstall` takes the app's icon out of the Dock once the app is in the Trash, unless told+ /// to keep it, and says so before it asks.+ @Test func takesTheAppsIconOutOfTheDockOnceItIsInTheTrash() {+ let app = InstalledApp(+ url: URL(filePath: "/Applications/Example.app", directoryHint: .isDirectory),+ bundleIdentifier: "org.example.app", name: "Example"+ )+ let trashed = URL(filePath: "/Users/me/.Trash/Example.app")+ let moved = TrashResult(trashed: [TrashedItem(originalURL: app.url, trashedURL: trashed, date: .now)])++ #expect(UninstallCommand.takesOutDockIcon(of: app, after: moved, keeping: false))+ #expect(!UninstallCommand.takesOutDockIcon(of: app, after: moved, keeping: true))+ #expect(!UninstallCommand.takesOutDockIcon(of: app, after: TrashResult(), keeping: false))+ let note = UninstallCommand.dockNote(for: app, isInTheDock: true, keeping: false)+ #expect(note?.contains("--keep-in-dock") == true)+ #expect(UninstallCommand.dockNote(for: app, isInTheDock: false, keeping: false) == nil)+ #expect(UninstallCommand.dockNote(for: app, isInTheDock: true, keeping: true) == nil)+ }+@Test func parsesByteSizes() {#expect(ByteSize(argument: "2048")?.bytes == 2_048)#expect(ByteSize(argument: "500KB")?.bytes == 500_000)diff --git a/README.md b/README.mdindex aa6096af..5f4b0b00 100644--- a/README.md+++ b/README.md@@ -354,7 +354,7 @@ what stayed, and why. A Homebrew install also sets up its completions for zsh, b| `peel apps` | Lists installed apps. || `peel inventory` | Writes out what is installed and where each app came from, as text, JSON, CSV, or a Brewfile. || `peel leftovers <app>` | Shows the files an app leaves behind, and why each one belongs to it. |-| `peel uninstall <app>` | Moves an app and its leftovers to the Trash. `--reset-privacy` also clears the permissions macOS gave it. |+| `peel uninstall <app>` | Moves an app and its leftovers to the Trash, and takes its icon out of the Dock unless `--keep-in-dock` is given. `--reset-privacy` also clears the permissions macOS gave it. || `peel orphans` | Lists files left by apps that are no longer installed. `--remove <group>` moves one group. || `peel caches` | Lists the caches of developer tools. `--remove` moves the ones Peel suggests. || `peel projects <folders>` | Lists what builds left in your projects. `--remove` moves the ones Peel suggests. |diff --git a/Support/peel.1 b/Support/peel.1index 2061e902..a100f6ef 100644--- a/Support/peel.1+++ b/Support/peel.1@@ -1,5 +1,5 @@.\" "Generated by swift-argument-parser"-.Dd October 5, 2026+.Dd October 6, 2026.Dt PEEL 1.Os.Sh NAME@@ -80,6 +80,8 @@ Move only the app, not its leftovers.Also reset the app's privacy permissions, just before it moves, so it asks again if you reinstall it. The Trash can't bring them back..It Fl -dry-runShow what would move without moving anything.+.It Fl -keep-in-dock+Leave the app's icon in the Dock. Without it, the icon comes out once the app is in the Trash, and goes back where it was if the app is put back..It Fl y , -yesDon't ask for confirmation..It Fl -json