From 4e68fee1c1cda78b43d092be2d933e6c4a8114a2 Mon Sep 17 00:00:00 2001 From: hariel1985 Date: Mon, 2 Feb 2026 12:52:25 +0100 Subject: [PATCH] Auto-detect whisper-cli path for Intel and ARM Macs - Check multiple paths: /opt/homebrew/bin (ARM), /usr/local/bin (Intel), /opt/local/bin (MacPorts), ~/bin (user local) - Show error status if whisper-cli not found - Use isExecutableFile to verify binary exists and is executable Co-Authored-By: Claude Opus 4.5 --- macos/src/main.swift | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/macos/src/main.swift b/macos/src/main.swift index 297c399..ae75743 100644 --- a/macos/src/main.swift +++ b/macos/src/main.swift @@ -442,6 +442,24 @@ class AppDelegate: NSObject, NSApplicationDelegate { } } + // MARK: - Whisper CLI Detection + func findWhisperCLI() -> String? { + // Check common paths for whisper-cli + let paths = [ + "/opt/homebrew/bin/whisper-cli", // ARM Mac (M1/M2/M3) + "/usr/local/bin/whisper-cli", // Intel Mac + "/opt/local/bin/whisper-cli", // MacPorts + NSHomeDirectory() + "/bin/whisper-cli" // User local + ] + + for path in paths { + if FileManager.default.isExecutableFile(atPath: path) { + return path + } + } + return nil + } + // MARK: - Transcription func transcribe() { // Validate inputs before execution @@ -464,8 +482,18 @@ class AppDelegate: NSObject, NSApplicationDelegate { return } + guard let whisperPath = findWhisperCLI() else { + DispatchQueue.main.async { + self.statusItem.button?.title = "🎤" + self.updateStatus("⚠️ whisper-cli not found") + if self.playSounds { NSSound(named: "Basso")?.play() } + NSLog("whisper-cli not found in PATH") + } + return + } + let task = Process() - task.executableURL = URL(fileURLWithPath: "/opt/homebrew/bin/whisper-cli") + task.executableURL = URL(fileURLWithPath: whisperPath) task.arguments = ["-m", modelPath, "-l", language.lowercased(), "-f", audioFilePath] let pipe = Pipe()