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
Say that a kernel extension removed by an administrator needs a restart
Țugui Dragoș38059eea5ea3
diff --git a/Localization/Peel/Localizable.xcstrings b/Localization/Peel/Localizable.xcstringsindex 8c48d40c..98038e19 100644--- a/Localization/Peel/Localizable.xcstrings+++ b/Localization/Peel/Localizable.xcstrings@@ -225097,6 +225097,112 @@}}},+ "macOS changes the kernel extensions it loads only when the Mac restarts, so restart once this one is in the Trash." : {+ "localizations" : {+ "cs" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Systém macOS mění doplňky kernelu, které načítá, jen při restartu Macu, takže až bude tento doplněk v koši, Mac restartujte."+ }+ },+ "de" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "macOS ändert erst, wenn der Mac neu startet, welche Kernel-Erweiterungen es lädt. Starte den Mac daher neu, sobald diese Erweiterung im Papierkorb ist."+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Las extensiones del kernel que carga macOS solo cambian cuando el Mac se reinicia, así que reinicia el Mac cuando esta ya esté en la papelera."+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Les extensions du noyau que charge macOS ne changent qu’au redémarrage du Mac : redémarrez-le donc une fois que celle-ci est dans la corbeille."+ }+ },+ "it" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Le estensioni di kernel che macOS carica cambiano solo al riavvio del Mac, quindi riavvialo quando questa sarà nel Cestino."+ }+ },+ "ja" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "macOSが読み込むカーネル機能拡張を変更するのは、Macの再起動時だけです。そのため、これがゴミ箱に入ったら、Macを再起動してください。"+ }+ },+ "ko" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "macOS는 Mac을 재시동할 때만 로드할 커널 확장 프로그램을 변경하므로, 이 커널 확장 프로그램을 휴지통으로 이동한 다음 Mac을 재시동하십시오."+ }+ },+ "nl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "macOS wijzigt pas welke kernelextensies het laadt als de Mac opnieuw opstart, dus start de Mac opnieuw op zodra deze kernelextensie in de prullenmand staat."+ }+ },+ "pl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "macOS zmienia wczytywane rozszerzenia jądra dopiero po ponownym uruchomieniu Maca, więc uruchom Maca ponownie, gdy to rozszerzenie znajdzie się w Koszu."+ }+ },+ "pt" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "O macOS só muda as extensões de kernel que carrega quando o Mac é reiniciado, então reinicie o Mac assim que esta estiver no Lixo."+ }+ },+ "ro" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "macOS schimbă extensiile kernel pe care le încarcă doar când Mac‑ul repornește, așa că reporniți‑l după ce această extensie ajunge în Coș."+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "macOS меняет набор загружаемых расширений ядра только при перезагрузке Mac, поэтому перезагрузите Mac, когда это расширение окажется в Корзине."+ }+ },+ "sv" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "macOS ändrar inte vilka kärntillägg som läses in förrän datorn startas om, så starta om datorn när det här tillägget ligger i papperskorgen."+ }+ },+ "tr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "macOS, yüklediği çekirdek genişletmelerini yalnızca Mac yeniden başladığında değiştirir, bu yüzden bu genişletme Çöp Sepeti’ne taşındıktan sonra Mac’inizi yeniden başlatın."+ }+ },+ "uk" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "macOS змінює набір розширень ядра, які завантажує, лише під час перезапуску Mac, тож перезапустіть Mac, щойно це розширення опиниться в Смітнику."+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "macOS只在Mac重新启动时才会更改它所载入的内核功能扩展,因此在此项移到废纸篓后,请重新启动Mac。"+ }+ },+ "zh-Hant" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "macOS只會在Mac重新開機時變更它所載入的核心延伸功能,因此請在此延伸功能丟到「垃圾桶」後重新開機。"+ }+ }+ }+ },"macOS couldn’t find the app, so what it was allowed to access is still on record." : {"localizations" : {"cs" : {diff --git a/Packages/PeelCore/Sources/PeelCommandLine/Commands/FileCommands.swift b/Packages/PeelCore/Sources/PeelCommandLine/Commands/FileCommands.swiftindex 8985241c..19cf6fa9 100644--- a/Packages/PeelCore/Sources/PeelCommandLine/Commands/FileCommands.swift+++ b/Packages/PeelCore/Sources/PeelCommandLine/Commands/FileCommands.swift@@ -149,7 +149,7 @@ struct OrphansCommand: AsyncParsableCommand {/// What the list could not cover, the groups the person said belong to an app when that list can't be read, the/// folders Peel could not read and the places with more folders inside than Peel looks into, and how to remove- /// what only an administrator can move.+ /// what only an administrator can move, with the restart a kernel extension needs.static func notes(for scan: OrphanScan, ownersUnreadable: Bool) -> [String] {var notes: [String] = []if ownersUnreadable {@@ -162,7 +162,13 @@ struct OrphansCommand: AsyncParsableCommand {notes += scan.cutShortLocations.map {"There are more folders in \(Output.plain(Output.path($0.url))) than Peel looks inside, so an orphaned file may be in a folder Peel didn't reach."}- return notes + (scan.forAnAdministrator.isEmpty ? [] : [byHand])+ if !scan.forAnAdministrator.isEmpty {+ notes.append(byHand)+ }+ if scan.forAnAdministrator.contains(where: \.item.isKernelExtension) {+ notes.append(kernelExtensions)+ }+ return notes}/// Why nothing is listed when some apps could not be read: their files would look orphaned.@@ -205,6 +211,8 @@ struct OrphansCommand: AsyncParsableCommand {)}+ static let kernelExtensions = "macOS changes the kernel extensions it loads only when the Mac restarts, so restart once a .kext you removed is in the Trash."+/// How to remove what only an administrator can move, from a place Peel's helper may not move it from.static let byHand = "Only an administrator can move what Needs an administrator lists, and Peel's helper isn't allowed to move it from there. To remove one, reveal it in Finder with `open -R <path>`, drag it to the Trash, then enter an administrator name and password when macOS asks."diff --git a/Packages/PeelCore/Sources/PeelCore/Orphans/Orphan.swift b/Packages/PeelCore/Sources/PeelCore/Orphans/Orphan.swiftindex f5754cf8..47ebac8d 100644--- a/Packages/PeelCore/Sources/PeelCore/Orphans/Orphan.swift+++ b/Packages/PeelCore/Sources/PeelCore/Orphans/Orphan.swift@@ -31,6 +31,12 @@ public struct OrphanItem: Sendable, Hashable, Identifiable {public var id: URL { url }+ /// True for a kernel extension, which macOS takes out of the kernel only when the Mac restarts: since macOS 11,+ /// third-party kernel extensions load as one collection when the Mac starts up.+ public var isKernelExtension: Bool {+ url.pathExtension.caseInsensitiveCompare("kext") == .orderedSame+ }+public func isLocked(canUseHelper: Bool) -> Bool {requiresPrivileges && leftAlone == nil && !canUseHelper}diff --git a/Packages/PeelCore/Tests/PeelCoreTests/FileCommandTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/FileCommandTests.swiftindex 19f6fd34..5db3b774 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/FileCommandTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/FileCommandTests.swift@@ -590,6 +590,19 @@ struct FileCommandTests {#expect(report["needsFullDiskAccess"] as? Bool == true)}+ @Test func saysAKernelExtensionLeavesTheKernelOnlyWhenTheMacRestarts() throws {+ let directory = try TemporaryDirectory()+ let driver = try orphan("Example.kext", in: directory, heldBack: .beyondTheHelper, requiresPrivileges: true)+ let other = try orphan("com.example.gone", in: directory, heldBack: .beyondTheHelper, requiresPrivileges: true)+ var scan = OrphanScan(groups: [], unreadableLocations: [])+ scan.forAnAdministrator = [AdministratorItem(item: other, apps: ["Gone"])]++ #expect(driver.isKernelExtension && !other.isKernelExtension)+ #expect(!OrphansCommand.notes(for: scan, ownersUnreadable: false).contains(OrphansCommand.kernelExtensions))+ scan.forAnAdministrator.append(AdministratorItem(item: driver, apps: ["Gone"]))+ #expect(OrphansCommand.notes(for: scan, ownersUnreadable: false).last == OrphansCommand.kernelExtensions)+ }+@Test func listsApartWhatOnlyAnAdministratorCanMove() throws {let directory = try TemporaryDirectory()let item = try orphan("com.example.gone", in: directory, heldBack: .beyondTheHelper, requiresPrivileges: true)diff --git a/Peel/Views/Orphans/AdministratorItemsView.swift b/Peel/Views/Orphans/AdministratorItemsView.swiftindex 59b9fa2f..15f71c0f 100644--- a/Peel/Views/Orphans/AdministratorItemsView.swift+++ b/Peel/Views/Orphans/AdministratorItemsView.swift@@ -54,10 +54,15 @@ struct AdministratorItemsView: View {}private func warning(for entry: AdministratorItem) -> String {- let why = String(localized: HoldBack.beyondTheHelper.explanation)- guard entry.claim?.confidence == .possible else { return why }- let apps = entry.apps.formatted(.list(type: .and))- return why + "\n\n" + String(localized: "Peel isn’t sure only \(apps) used this. Check it before you remove it.")+ var lines = [String(localized: HoldBack.beyondTheHelper.explanation)]+ if entry.claim?.confidence == .possible {+ let apps = entry.apps.formatted(.list(type: .and))+ lines.append(String(localized: "Peel isn’t sure only \(apps) used this. Check it before you remove it."))+ }+ if entry.item.isKernelExtension {+ lines.append(String(localized: "macOS changes the kernel extensions it loads only when the Mac restarts, so restart once this one is in the Trash."))+ }+ return lines.joined(separator: "\n\n")}private var header: some View {