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.

Say how to set the startup disk's security back beside a kernel extension

Țugui Dragoșda16c468e5c1
diff --git a/GUIDE.md b/GUIDE.md
index 5567b4a2..5780957e 100644
--- a/GUIDE.md
+++ b/GUIDE.md
@@ -123,7 +123,8 @@ Space shows what fills your disk, area by area, and what each area is.
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.
+ 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/Localization/Peel/Localizable.xcstrings b/Localization/Peel/Localizable.xcstrings
index d5d9dacd..df5f779b 100644
--- a/Localization/Peel/Localizable.xcstrings
+++ b/Localization/Peel/Localizable.xcstrings
@@ -68667,6 +68667,112 @@
}
}
},
+ "If you set the startup disk’s security to Reduced Security to install it, it stays that way until you choose Full Security again: in the Recovery app, choose Utilities > Startup Security Utility." : {
+ "localizations" : {
+ "cs" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Pokud jste kvůli instalaci tohoto doplňku nastavili zabezpečení startovacího disku na snížené zabezpečení, zůstane takto nastavené, dokud znovu nezvolíte úplné zabezpečení: v zotavovacím režimu zvolte Utility > Utilita zabezpečeného spouštění."
+ }
+ },
+ "de" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Falls du die Sicherheitsstufe des Startvolumes auf „Reduzierte Sicherheit“ verringert hast, um diese Erweiterung zu installieren, bleibt es dabei, bis du wieder „Volle Sicherheit“ festlegst: Wähle dazu in der macOS-Wiederherstellung „Dienstprogramme“ > „Startsicherheitsdienstprogramm“."
+ }
+ },
+ "es" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Si para instalarla ajustaste la seguridad del disco de arranque a seguridad reducida, seguirá así hasta que vuelvas a elegir seguridad máxima: en la función de recuperación de macOS, elige Utilidades > Utilidad de Seguridad de Arranque."
+ }
+ },
+ "fr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Si vous avez défini la sécurité du disque de démarrage sur « Sécurité réduite » pour l’installer, elle reste ainsi jusqu’à ce que vous choisissiez de nouveau « Sécurité maximale » : dans la fonctionnalité de récupération de macOS, choisissez Utilitaires > Utilitaire Sécurité au démarrage."
+ }
+ },
+ "it" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Se per installarla hai impostato la sicurezza del disco di avvio su “Sicurezza ridotta”, l’impostazione resta tale finché non scegli di nuovo “Sicurezza totale”: in Recupero di macOS, scegli Utility > Utility Sicurezza Avvio."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "これをインストールするために起動ディスクのセキュリティを“低セキュリティ”に設定した場合、再び“完全なセキュリティ”を選択するまで、その設定のままになります。“完全なセキュリティ”に戻すには、macOS復旧で“ユーティリティ”>“起動セキュリティユーティリティ”と選択してください。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "이 커널 확장 프로그램을 설치하기 위해 시동 디스크의 보안 정책을 부분 보안으로 설정했다면, 다시 완전 보안을 선택할 때까지 부분 보안으로 유지됩니다. 완전 보안을 선택하려면 macOS 복구에서 유틸리티 > 시동 보안 유틸리티를 선택하십시오."
+ }
+ },
+ "nl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Als je de beveiliging van de opstartschijf op 'Verminderde beveiliging' hebt ingesteld om die te installeren, blijft dat zo totdat je weer 'Volledige beveiliging' kiest: kies in macOS-herstel Hulpprogramma's > Opstartbeveiligingshulpprogramma."
+ }
+ },
+ "pl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Jeśli do jego zainstalowania zmieniono zasadę ochrony dysku startowego na Obniżony poziom zabezpieczeń, pozostanie ona taka, dopóki ponownie nie wybierzesz opcji Pełne zabezpieczenia: w trybie odzyskiwania macOS wybierz polecenie Narzędzia > Narzędzie bezpiecznego uruchamiania."
+ }
+ },
+ "pt" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Se você definiu a segurança do disco de inicialização como Segurança Reduzida para instalá-la, ela continua reduzida até você escolher Segurança Total novamente: na Recuperação do macOS, escolha Utilitários > Utilitário de Segurança da Inicialização."
+ }
+ },
+ "ro" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Dacă, pentru a o instala, ați configurat securitatea discului de inițializare la „Securitate redusă”, aceasta rămâne așa până când alegeți din nou „Securitate completă”: în aplicația Recuperare macOS, alegeți Utilitare > Utilitar securitate la inițializare."
+ }
+ },
+ "ru" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Если ради его установки Вы задали для загрузочного диска сниженный уровень безопасности, этот уровень сохранится, пока Вы снова не выберете высший уровень безопасности: в режиме восстановления macOS выберите «Утилиты» > «Утилита безопасной загрузки»."
+ }
+ },
+ "sv" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Om du ställde in startskivans säkerhet på Minskad säkerhet för att installera det, förblir den så tills du väljer Full säkerhet igen: välj Verktyg > Startsäkerhetsverktyg i macOS Återställning."
+ }
+ },
+ "tr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Bunu yüklemek için başlangıç diskinin güvenliğini Azaltılmış Güvenlik olarak ayarladıysanız, siz yeniden Tam Güvenlik’i seçene kadar öyle kalır: macOS Kurtarma’da İzlenceler > Başlangıç Güvenliği İzlencesi’ni seçin."
+ }
+ },
+ "uk" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Якщо для його інсталювання ви змінили політику безпеки стартового диска на «Послаблена безпека», вона такою й лишиться, доки ви знову не виберете «Повна безпека»: у розділі «Відновлення macOS» виберіть Утиліти > Утиліта безпеки запуску."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "如果你为了安装它而将启动磁盘的安全性设为“降低安全性”,它会一直保持这一设置,直到你重新将其设为“完整安全性”:在“macOS恢复”中,选取“实用工具”>“启动安全性实用工具”。"
+ }
+ },
+ "zh-Hant" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "如果你為了安裝它而將啟動磁碟的安全性設為「較低安全性」,此設定會一直保留,直到你再次選擇「完整安全性」為止:在「macOS復原」中,選擇「工具程式」>「開機安全性工具程式」。"
+ }
+ }
+ }
+ },
"Image Units" : {
"localizations" : {
"cs" : {
diff --git a/Packages/PeelCore/Sources/PeelCommandLine/Commands/FileCommands.swift b/Packages/PeelCore/Sources/PeelCommandLine/Commands/FileCommands.swift
index f1123bcd..5a43994a 100644
--- a/Packages/PeelCore/Sources/PeelCommandLine/Commands/FileCommands.swift
+++ b/Packages/PeelCore/Sources/PeelCommandLine/Commands/FileCommands.swift
@@ -149,8 +149,11 @@ 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, with the restart a kernel extension needs.
- static func notes(for scan: OrphanScan, ownersUnreadable: Bool) -> [String] {
+ /// what only an administrator can move, with what a kernel extension needs: a restart, and on Apple silicon the
+ /// startup disk's security set back.
+ static func notes(
+ for scan: OrphanScan, ownersUnreadable: Bool, onAppleSilicon: Bool = HostArchitecture.isAppleSilicon
+ ) -> [String] {
var notes: [String] = []
if ownersUnreadable {
notes.append("Peel can't read the list of orphaned files you said belong to an app, so it lists them too. Start the list over in Peel's Settings > Exclusions.")
@@ -167,6 +170,7 @@ struct OrphansCommand: AsyncParsableCommand {
}
if scan.forAnAdministrator.contains(where: \.item.url.isKernelExtension) {
notes.append(kernelExtensions)
+ if onAppleSilicon { notes.append(reducedSecurity) }
}
return notes
}
@@ -214,6 +218,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."
+ static let reducedSecurity = "If you set the startup disk's security to Reduced Security to install a .kext, it stays that way until you choose Full Security again: in the Recovery app, choose Utilities > Startup Security Utility."
+
/// 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/Tests/PeelCoreTests/FileCommandTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/FileCommandTests.swift
index d7aeac10..ae97bbf1 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/FileCommandTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/FileCommandTests.swift
@@ -686,9 +686,27 @@ struct FileCommandTests {
scan.forAnAdministrator = [AdministratorItem(item: other, apps: ["Gone"])]
#expect(driver.url.isKernelExtension && !other.url.isKernelExtension)
- #expect(!OrphansCommand.notes(for: scan, ownersUnreadable: false).contains(OrphansCommand.kernelExtensions))
+ #expect(!OrphansCommand.notes(for: scan, ownersUnreadable: false, onAppleSilicon: false)
+ .contains(OrphansCommand.kernelExtensions))
scan.forAnAdministrator.append(AdministratorItem(item: driver, apps: ["Gone"]))
- #expect(OrphansCommand.notes(for: scan, ownersUnreadable: false).last == OrphansCommand.kernelExtensions)
+ #expect(OrphansCommand.notes(for: scan, ownersUnreadable: false, onAppleSilicon: false).last
+ == OrphansCommand.kernelExtensions)
+ }
+
+ @Test func saysOnAppleSiliconHowToSetTheStartupDisksSecurityBackAfterAKernelExtension() 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(!OrphansCommand.notes(for: scan, ownersUnreadable: false, onAppleSilicon: true)
+ .contains(OrphansCommand.reducedSecurity))
+ scan.forAnAdministrator.append(AdministratorItem(item: driver, apps: ["Gone"]))
+ #expect(OrphansCommand.notes(for: scan, ownersUnreadable: false, onAppleSilicon: true).suffix(2)
+ == [OrphansCommand.kernelExtensions, OrphansCommand.reducedSecurity])
+ #expect(!OrphansCommand.notes(for: scan, ownersUnreadable: false, onAppleSilicon: false)
+ .contains(OrphansCommand.reducedSecurity))
}
@Test func listsApartWhatOnlyAnAdministratorCanMove() throws {
diff --git a/Peel/Views/Orphans/AdministratorItemsView.swift b/Peel/Views/Orphans/AdministratorItemsView.swift
index 79e1aa17..d4e54fce 100644
--- a/Peel/Views/Orphans/AdministratorItemsView.swift
+++ b/Peel/Views/Orphans/AdministratorItemsView.swift
@@ -60,7 +60,7 @@ struct AdministratorItemsView: View {
lines.append(String(localized: "Peel isn’t sure only \(apps) used this. Check it before you remove it."))
}
if entry.item.url.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."))
+ lines += KernelExtensionNotes.lines()
}
return lines.joined(separator: "\n\n")
}
diff --git a/Peel/Views/Packages/PackageDetailView.swift b/Peel/Views/Packages/PackageDetailView.swift
index 8177e516..3e9142fc 100644
--- a/Peel/Views/Packages/PackageDetailView.swift
+++ b/Peel/Views/Packages/PackageDetailView.swift
@@ -266,8 +266,7 @@ struct PackageDetailView: View {
guard let heldBack = item.heldBack else { return nil }
let why = String(localized: heldBack.explanation)
guard heldBack == .beyondTheHelper, item.url.isKernelExtension else { return why }
- return why + "\n\n"
- + String(localized: "macOS changes the kernel extensions it loads only when the Mac restarts, so restart once this one is in the Trash.")
+ return ([why] + KernelExtensionNotes.lines()).joined(separator: "\n\n")
}
}
diff --git a/Peel/Views/Presentation.swift b/Peel/Views/Presentation.swift
index 7a492ba0..a816a222 100644
--- a/Peel/Views/Presentation.swift
+++ b/Peel/Views/Presentation.swift
@@ -142,6 +142,16 @@ extension UninstallsItself {
}
}
+/// What Peel says beside a kernel extension it lists.
+enum KernelExtensionNotes {
+ static func lines(onAppleSilicon: Bool = HostArchitecture.isAppleSilicon) -> [String] {
+ let restart = String(localized: "macOS changes the kernel extensions it loads only when the Mac restarts, so restart once this one is in the Trash.")
+ guard onAppleSilicon else { return [restart] }
+ // On Apple silicon a kernel extension is installed only once the startup disk's security is Reduced Security.
+ return [restart, String(localized: "If you set the startup disk’s security to Reduced Security to install it, it stays that way until you choose Full Security again: in the Recovery app, choose Utilities > Startup Security Utility.")]
+ }
+}
+
extension GuardRefusal {
/// Why Peel never moves the item, in words for the person who asked to move it.
var explanation: LocalizedStringResource {
diff --git a/PeelTests/KernelExtensionNotesTests.swift b/PeelTests/KernelExtensionNotesTests.swift
new file mode 100644
index 00000000..0529efde
--- /dev/null
+++ b/PeelTests/KernelExtensionNotesTests.swift
@@ -0,0 +1,14 @@
+import Foundation
+@testable import Peel
+import Testing
+
+@MainActor
+struct KernelExtensionNotesTests {
+ @Test func saysOnAppleSiliconHowToSetTheStartupDisksSecurityBack() {
+ let restart = String(localized: "macOS changes the kernel extensions it loads only when the Mac restarts, so restart once this one is in the Trash.")
+ let security = String(localized: "If you set the startup disk’s security to Reduced Security to install it, it stays that way until you choose Full Security again: in the Recovery app, choose Utilities > Startup Security Utility.")
+
+ #expect(KernelExtensionNotes.lines(onAppleSilicon: false) == [restart])
+ #expect(KernelExtensionNotes.lines(onAppleSilicon: true) == [restart, security])
+ }
+}