Skip to content

fix: add postinstall script to fix node-pty spawn-helper permissions on macOS#294

Open
amacsmith wants to merge 5 commits intositeboon:mainfrom
amacsmith:fix/node-pty-spawn-helper-permissions
Open

fix: add postinstall script to fix node-pty spawn-helper permissions on macOS#294
amacsmith wants to merge 5 commits intositeboon:mainfrom
amacsmith:fix/node-pty-spawn-helper-permissions

Conversation

@amacsmith
Copy link

@amacsmith amacsmith commented Jan 12, 2026

Summary

Fixes the posix_spawnp failed error that occurs on macOS when trying to start terminal sessions.

  • Adds a postinstall script to package.json that automatically fixes spawn-helper permissions
  • Adds troubleshooting documentation to README.md explaining the issue and manual fix
  • Updates node-pty to stable v1.0.0

Problem

The node-pty package's spawn-helper binary may be shipped without execute permissions in npm tarballs, causing errors like:

Error: posix_spawnp failed.
    at new UnixTerminal (node_modules/node-pty/lib/unixTerminal.js:92:24)

This commonly happens on macOS when:

  • Installing via npx or pnpm
  • The npm tarball doesn't preserve the execute bit

Solution

The postinstall script runs chmod 755 on the spawn-helper binary after each install:

const helper = path.join(__dirname, 'node_modules/node-pty/prebuilds', process.platform + '-' + process.arch, 'spawn-helper');
fs.chmodSync(helper, 0o755);

Test plan

  • Verified fix on macOS Apple Silicon
  • Tested fresh npm install properly sets permissions
  • Confirmed shell/terminal sessions work after fix

Fixes #284

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Documentation

    • Expanded troubleshooting with step‑by‑step guidance for macOS terminal spawn errors, project discovery failures, and file explorer connectivity/permission issues.
  • Chores

    • Adjusted a runtime dependency to a more stable version and added a post‑install step to address installation permission/setup issues.

✏️ Tip: You can customize this high-level summary in your review settings.

…on macOS

The node-pty package's spawn-helper binary may be shipped without execute
permissions in npm tarballs, causing "posix_spawnp failed" errors on macOS
when trying to start terminal sessions.

This commit:
- Adds a postinstall script that automatically fixes spawn-helper permissions
- Adds troubleshooting documentation to README.md explaining the issue
- Updates node-pty to stable v1.0.0

Fixes siteboon#284

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings January 12, 2026 23:14
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 12, 2026

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

Added detailed troubleshooting subsections to README.md (macOS posix_spawnp, expanded "No Claude projects found", and "File Explorer Issues") and modified package.json to add a postinstall script, adjust release script punctuation, and downgrade node-pty to 1.0.0.

Changes

Cohort / File(s) Summary
Documentation
README.md
Added troubleshooting subsections: "Shell/Terminal Fails with posix_spawnp failed (macOS)" (Problem/Cause/Solution/Permanent Fix/Related Issues), expanded "No Claude projects found" with explicit solution steps, and new "File Explorer Issues" solutions covering permissions, path accessibility, server logs, and directory access scope.
Package manifest
package.json
Added postinstall script to run chmod on node-pty prebuild's spawn-helper, downgraded node-pty from ^1.1.0-beta34 to ^1.0.0, and updated release script punctuation (trailing comma).

Sequence Diagram(s)

(omitted — changes are documentation and a small package.json update without new multi-component control flow)

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰
I nudged a helper, fixed its way,
A chmod hop to save the day,
Wrote notes for shells and folders gray,
Terminals hum, projects display,
I nibble carrots, code okay. 🥕

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: adding a postinstall script to fix node-pty spawn-helper permissions on macOS.
Linked Issues check ✅ Passed The PR fully addresses issue #284 requirements: fixes spawn-helper permissions via postinstall script, adds troubleshooting documentation, and updates node-pty to stable v1.0.0.
Out of Scope Changes check ✅ Passed All changes are directly related to fixing the posix_spawnp error on macOS; README additions document the issue and manual fix, package.json changes implement the automatic fix.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In @README.md:
- Around line 324-326: Update the fenced code block that contains the line
"Error: posix_spawnp failed." in README.md to include a language specifier
(e.g., use ```text or ```plaintext) so the block becomes a labeled code fence;
locate the exact fenced block in the file and prepend the language token to
satisfy linting and ensure consistent rendering.
📜 Review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 42b2d5e and 05dee7e.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (2)
  • README.md
  • package.json
🧰 Additional context used
🪛 markdownlint-cli2 (0.18.1)
README.md

324-324: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Agent
🔇 Additional comments (4)
package.json (3)

33-33: Postinstall script looks correct for the stated purpose.

The inline script correctly constructs the platform-specific path and applies chmod 755. The try/catch gracefully handles cases where the file doesn't exist (e.g., Windows, or different architectures).

Minor observations:

  • The script runs on all platforms but only macOS requires this fix. Consider adding a platform check (process.platform === 'darwin') to skip unnecessary work on Linux/Windows.
  • If users have multiple node-pty versions or nested node_modules, the fix only applies to the top-level install.

These are minor optimizations and the current implementation is functional.


93-93: Verify: Unrelated dependency addition?

The task-master-ai dependency appears unrelated to the PR's stated objective of fixing the node-pty spawn-helper permissions issue (#284). Consider splitting this into a separate PR for cleaner change tracking, or clarify in the PR description if this addition is intentional.


81-81: Good move to stable version.

Downgrading from beta (^1.1.0-beta34) to stable (^1.0.0) improves reliability. This aligns with the PR's goal of fixing terminal issues.

README.md (1)

322-344: Well-documented troubleshooting section.

The troubleshooting documentation is comprehensive, covering the problem, cause, solution, and permanent fix. The inclusion of architecture-specific paths (Intel vs Apple Silicon) and verification commands is helpful for users.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses the posix_spawnp failed error on macOS by adding a postinstall script to automatically fix spawn-helper permissions and updating the node-pty dependency.

Changes:

  • Adds postinstall script to chmod the node-pty spawn-helper binary to 755
  • Updates node-pty from ^1.1.0-beta34 to ^1.0.0
  • Adds comprehensive troubleshooting documentation for the macOS spawn-helper permissions issue

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 2 comments.

File Description
package.json Adds postinstall script for fixing spawn-helper permissions, updates node-pty version, and adds task-master-ai dependency
README.md Adds detailed troubleshooting section explaining the posix_spawnp error and solutions

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

- Add `text` language specifier to error code block in README.md
- Remove unrelated `task-master-ai` dependency
- Improve postinstall error handling: only silence ENOENT errors,
  log actual permission failures for debugging

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@amacsmith amacsmith requested a review from Copilot January 12, 2026 23:37
@amacsmith
Copy link
Author

Hey @viper151 @blackmammoth 👋

This PR fixes issue #284 - the posix_spawnp failed error that affects macOS users when trying to use the Shell/Terminal feature.

Summary of changes:

  • Added a postinstall script that automatically fixes spawn-helper permissions after npm install
  • Added troubleshooting documentation to README.md
  • Updated node-pty from beta to stable v1.0.0

I've addressed the review feedback from CodeRabbit and Copilot:

  • Added text language specifier to the error code block
  • Removed the unrelated task-master-ai dependency
  • Improved error handling to only silence expected ENOENT errors

Would appreciate a review when you get a chance. Thanks! 🙏

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 3 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +329 to +331
**Cause**: The `node-pty` package's `spawn-helper` binary may be missing execute permissions after installation. This commonly happens on macOS when:
- Installing via `npx` or `pnpm`
- The npm tarball doesn't preserve the execute bit
Copy link

Copilot AI Jan 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The troubleshooting section describes the issue as "commonly happens on macOS when installing via npx or pnpm" but the postinstall script will run for all package managers (npm, yarn, pnpm, etc.) on all platforms. Consider clarifying in the documentation that while the issue commonly occurs with certain package managers on macOS, the postinstall fix applies universally. Alternatively, if the issue is truly specific to certain installation methods, the documentation should explain why the postinstall script may not always be sufficient.

Copilot uses AI. Check for mistakes.
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot open a new pull request to apply changes based on this feedback

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot open a new pull request to apply changes based on this feedback

amacsmith and others added 2 commits January 18, 2026 04:21
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

When trying to login to claude code from the interface I see an error

2 participants