From 9fab7a803451fb89a2cb6a54f0260b9f3be25cf9 Mon Sep 17 00:00:00 2001 From: Cyril Feraudet Date: Wed, 28 Jan 2026 11:37:40 +0100 Subject: [PATCH 1/3] fix(macos): fix node-pty posix_spawnp error with postinstall script Add postinstall script that fixes spawn-helper permissions on macOS. The node-pty package ships spawn-helper without execute permissions (644), causing "posix_spawnp failed" errors when spawning terminal processes. Closes #284 Co-Authored-By: Claude Opus 4.5 --- package.json | 3 +- scripts/fix-node-pty.js | 67 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 scripts/fix-node-pty.js diff --git a/package.json b/package.json index fdc47aec7..f54c457f0 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,8 @@ "build": "vite build", "preview": "vite preview", "start": "npm run build && npm run server", - "release": "./release.sh" + "release": "./release.sh", + "postinstall": "node scripts/fix-node-pty.js" }, "keywords": [ "claude coode", diff --git a/scripts/fix-node-pty.js b/scripts/fix-node-pty.js new file mode 100644 index 000000000..8009bfd1a --- /dev/null +++ b/scripts/fix-node-pty.js @@ -0,0 +1,67 @@ +#!/usr/bin/env node +/** + * Fix node-pty spawn-helper permissions on macOS + * + * This script fixes a known issue with node-pty where the spawn-helper + * binary is shipped without execute permissions, causing "posix_spawnp failed" errors. + * + * @see https://github.com/microsoft/node-pty/issues/850 + * @module scripts/fix-node-pty + */ + +import { promises as fs } from 'fs'; +import path from 'path'; +import { fileURLToPath } from 'url'; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); + +/** + * Fixes the spawn-helper binary permissions for node-pty on macOS. + * + * The node-pty package ships the spawn-helper binary without execute permissions + * (644 instead of 755), which causes "posix_spawnp failed" errors when trying + * to spawn terminal processes. + * + * This function: + * 1. Checks if running on macOS (darwin) + * 2. Locates spawn-helper binaries for both arm64 and x64 architectures + * 3. Sets execute permissions (755) on each binary found + * + * @async + * @function fixSpawnHelper + * @returns {Promise} Resolves when permissions are fixed or skipped + * @example + * // Run as postinstall script + * await fixSpawnHelper(); + */ +async function fixSpawnHelper() { + const nodeModulesPath = path.join(__dirname, '..', 'node_modules', 'node-pty', 'prebuilds'); + + // Only run on macOS + if (process.platform !== 'darwin') { + return; + } + + const darwinDirs = ['darwin-arm64', 'darwin-x64']; + + for (const dir of darwinDirs) { + const spawnHelperPath = path.join(nodeModulesPath, dir, 'spawn-helper'); + + try { + // Check if file exists + await fs.access(spawnHelperPath); + + // Make it executable (755) + await fs.chmod(spawnHelperPath, 0o755); + console.log(`[postinstall] Fixed permissions for ${spawnHelperPath}`); + } catch (err) { + // File doesn't exist or other error - ignore + if (err.code !== 'ENOENT') { + console.warn(`[postinstall] Warning: Could not fix ${spawnHelperPath}: ${err.message}`); + } + } + } +} + +fixSpawnHelper().catch(console.error); From 340e34bab719b51156edf325fd5a5c254668bb39 Mon Sep 17 00:00:00 2001 From: viper151 Date: Wed, 18 Feb 2026 12:06:36 +0100 Subject: [PATCH 2/3] fix: Add scripts to package.json --- package-lock.json | 1 + package.json | 1 + 2 files changed, 2 insertions(+) diff --git a/package-lock.json b/package-lock.json index e94d71583..536b64e86 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7,6 +7,7 @@ "": { "name": "@siteboon/claude-code-ui", "version": "1.18.2", + "hasInstallScript": true, "license": "GPL-3.0", "dependencies": { "@anthropic-ai/claude-agent-sdk": "^0.1.71", diff --git a/package.json b/package.json index 1e0c9a500..3c5e0c496 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ "server/", "shared/", "dist/", + "scripts/", "README.md" ], "homepage": "https://cloudcli.ai", From 665643dc7e3acfa4486372ac64c98057222c644a Mon Sep 17 00:00:00 2001 From: viper151 Date: Wed, 18 Feb 2026 12:19:19 +0100 Subject: [PATCH 3/3] chore: trigger merge check