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.

Give Apple's command for Rosetta where nothing opens to offer it

Țugui Dragoș7d587df4fcd3
diff --git a/Localization/Peel/Localizable.xcstrings b/Localization/Peel/Localizable.xcstrings
index 1f274085..487c4d73 100644
--- a/Localization/Peel/Localizable.xcstrings
+++ b/Localization/Peel/Localizable.xcstrings
@@ -142407,6 +142407,112 @@
}
}
},
+ "Run this in Terminal to install Rosetta, then follow its instructions." : {
+ "localizations" : {
+ "cs" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Spusťte tento příkaz v Terminálu, abyste nainstalovali prostředí Rosetta, a pak postupujte podle jeho pokynů."
+ }
+ },
+ "de" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Führe diesen Befehl im Terminal aus, um Rosetta zu installieren, und folge dann den Anweisungen."
+ }
+ },
+ "es" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Ejecuta esto en Terminal para instalar Rosetta y, después, sigue sus instrucciones."
+ }
+ },
+ "fr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Exécutez cette commande dans Terminal pour installer Rosetta, puis suivez ses instructions."
+ }
+ },
+ "it" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Esegui questo comando in Terminale per installare Rosetta, poi segui le sue istruzioni."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Rosettaをインストールするには、ターミナルで以下のコマンドを実行し、表示される指示に従ってください。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Rosetta를 설치하려면 터미널에서 이 명령을 실행한 다음 안내를 따르십시오."
+ }
+ },
+ "nl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Voer dit uit in Terminal om Rosetta te installeren en volg daarna de instructies."
+ }
+ },
+ "pl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Uruchom to polecenie w Terminalu, aby zainstalować Rosettę, a następnie postępuj zgodnie z jego instrukcjami."
+ }
+ },
+ "pt" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Execute este comando no Terminal para instalar o Rosetta e depois siga as instruções dele."
+ }
+ },
+ "ro" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Rulați această comandă în Terminal pentru a instala Rosetta, apoi urmați instrucțiunile ei."
+ }
+ },
+ "ru" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Выполните эту команду в Терминале, чтобы установить Rosetta, а затем следуйте ее инструкциям."
+ }
+ },
+ "sv" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Kör det här i Terminal för att installera Rosetta och följ sedan instruktionerna."
+ }
+ },
+ "tr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Rosetta’yı yüklemek için bunu Terminal’de çalıştırın, ardından verdiği yönergeleri izleyin."
+ }
+ },
+ "uk" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Виконайте цю команду в Терміналі, щоб інсталювати Rosetta, а потім дотримуйтеся її вказівок."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "在“终端”中运行此命令以安装Rosetta,然后按照其说明操作。"
+ }
+ },
+ "zh-Hant" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "在「終端機」中執行此指令以安裝Rosetta,然後依照它的指示操作。"
+ }
+ }
+ }
+ },
"Run this in Terminal. It deletes for good, without the Trash." : {
"localizations" : {
"cs" : {
diff --git a/Packages/PeelCore/Sources/PeelCore/Apps/Rosetta.swift b/Packages/PeelCore/Sources/PeelCore/Apps/Rosetta.swift
index 481cdb20..56afdbdb 100644
--- a/Packages/PeelCore/Sources/PeelCore/Apps/Rosetta.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Apps/Rosetta.swift
@@ -26,6 +26,10 @@ public enum Rosetta {
"/Library/Apple/usr/libexec/oah/libRosettaRuntime",
]
+ /// The command Apple gives for installing Rosetta in Terminal (`man softwareupdate`), which then asks the person to
+ /// agree to its license.
+ public static let installCommand = "softwareupdate --install-rosetta"
+
public static var isInstalled: Bool {
installed(among: paths)
}
diff --git a/Peel/Model/IntelLibrary.swift b/Peel/Model/IntelLibrary.swift
index 1bc697ce..8e57861d 100644
--- a/Peel/Model/IntelLibrary.swift
+++ b/Peel/Model/IntelLibrary.swift
@@ -46,6 +46,9 @@ extension IntelFinding.Kind {
}
}
+ /// Whether opening it is a way to install Rosetta: macOS offers to the first time an Intel app opens.
+ var offersRosettaWhenOpened: Bool { self == .app }
+
var systemImage: String {
switch self {
case .app: "app.badge"
diff --git a/Peel/Views/Intel/IntelDetailView.swift b/Peel/Views/Intel/IntelDetailView.swift
index b6b9a925..58f6ffc8 100644
--- a/Peel/Views/Intel/IntelDetailView.swift
+++ b/Peel/Views/Intel/IntelDetailView.swift
@@ -49,6 +49,12 @@ struct IntelDetailView: View {
Text("Rosetta isn’t installed on this Mac, so this doesn’t run at all. macOS offers to install it the first time you open an Intel app, and macOS 27 is the last release that runs most Intel software through it.")
.font(.callout)
.foregroundStyle(.secondary)
+ if !finding.kind.offersRosettaWhenOpened {
+ CopyableLines(
+ caption: Text("Run this in Terminal to install Rosetta, then follow its instructions."),
+ lines: [Rosetta.installCommand]
+ )
+ }
}
// The list also names Intel apps that are only installed, so it matters without Rosetta too.
if #available(macOS 27, *) {
diff --git a/PeelTests/IntelExplanationTests.swift b/PeelTests/IntelExplanationTests.swift
index 66e98e4f..e47e13cc 100644
--- a/PeelTests/IntelExplanationTests.swift
+++ b/PeelTests/IntelExplanationTests.swift
@@ -21,4 +21,9 @@ struct IntelExplanationTests {
#expect(!plugin(.screenSavers).loadsThroughAnApp)
#expect(String(localized: plugin(.vst3).explanation(onAppleSilicon: false)) == String(localized: "This plug-in is Intel only. On this Intel Mac it loads natively."))
}
+
+ @Test func givesApplesCommandWhereNothingOpensToOfferRosetta() {
+ #expect(IntelFinding.Kind.allCases.filter(\.offersRosettaWhenOpened) == [.app])
+ #expect(Rosetta.installCommand == "softwareupdate --install-rosetta")
+ }
}