From d4f03ca62cb6af7627ade5212b4d4d821134d2cd Mon Sep 17 00:00:00 2001 From: Roman Schlagowsky Date: Wed, 25 Feb 2026 10:28:44 +0100 Subject: [PATCH] fix: node-pty spawn-helper permissions on macOS with pnpm pnpm doesn't preserve execute bits from node-pty prebuilds, causing posix_spawnp to fail when spawning PTY processes. - Add postinstall script to chmod +x spawn-helper for darwin-* - Skip otool Metal detection when whisper-cli isn't installed Co-Authored-By: Claude Opus 4.5 --- bridge/src/voice.ts | 5 +++++ package.json | 3 ++- scripts/postinstall.sh | 9 +++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) create mode 100755 scripts/postinstall.sh diff --git a/bridge/src/voice.ts b/bridge/src/voice.ts index bf7f51e..663bbfa 100644 --- a/bridge/src/voice.ts +++ b/bridge/src/voice.ts @@ -25,6 +25,11 @@ function findBinary(candidates: string[], fallback: string): string { /** Check if a whisper-cli binary has Metal GPU support (native arm64 + libggml-metal). */ function detectMetal(whisperPath: string): boolean { + // Skip if whisper-cli doesn't exist (just a fallback name, not installed) + if (!existsSync(whisperPath)) { + debug('Voice', `whisper-cli not found, skipping Metal detection`); + return false; + } try { const otoolOut = execSync(`otool -L "${whisperPath}"`, { encoding: 'utf8' }); const hasMetal = otoolOut.includes('libggml-metal'); diff --git a/package.json b/package.json index 9d920b0..e85c253 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,8 @@ "generate-icons": "node scripts/generate-icons.mjs", "package": "bash scripts/package-plugin.sh", "setup": "bash scripts/install.sh", - "test": "vitest run" + "test": "vitest run", + "postinstall": "bash scripts/postinstall.sh" }, "engines": { "node": ">=20.0.0" diff --git a/scripts/postinstall.sh b/scripts/postinstall.sh new file mode 100755 index 0000000..129bad0 --- /dev/null +++ b/scripts/postinstall.sh @@ -0,0 +1,9 @@ +#!/bin/bash +# Fix node-pty spawn-helper permissions (pnpm doesn't preserve execute bits from prebuilds) + +find node_modules -path "*node-pty*/prebuilds/darwin-*/spawn-helper" 2>/dev/null | while read -r SPAWN_HELPER; do + if [ -n "$SPAWN_HELPER" ] && [ ! -x "$SPAWN_HELPER" ]; then + chmod +x "$SPAWN_HELPER" + echo "[postinstall] Fixed spawn-helper permissions: $SPAWN_HELPER" + fi +done