Three silent macOS traps that break Claude Code hook scripts explained
A developer debugging Claude Code hook scripts on macOS discovered three distinct failure modes that all share the trait of failing without any error output. The first trap involves zsh's read-only reserved variable 'status', which silently ignores assignment attempts unlike in bash, causing condition checks to never trigger. The second issue arises when Claude Code is launched as a GUI app, as child processes inherit only a minimal PATH that excludes tools like Node.js installed via nvm or Homebrew. The third trap is the absence of a 'timeout' command on macOS, which differs from Linux environments where it is available by default. The author recommends renaming reserved variables, setting a comprehensive 'env.PATH' in Claude Code's settings.json, and accounting for macOS-specific command availability when writing hook scripts.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in