agentsclimarketplace

Macos hook path timeout

Skill bokuwalily/claude-code-skills/skills/macos-hook-path-timeout

75 battle-tested Claude Code skills from shipping 20+ apps solo — macOS, Next.js, Vercel, iOS/Expo, Cloudflare, Phaser, local AI media & more

Install
npx -y skills add bokuwalily/claude-code-skills --skill macos-hook-path-timeout

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

macOSでClaude Codeのhookやlaunchdジョブが `node: command not found` / `timeout: not found` で失敗する時に使う。GUI起動アプリの最小PATH問題と、macOSにGNU coreutils(timeout)が無い問題の、検証済み回避策。

SKILL.md

2.9 KB, as published. Nobody here has run it

Procedure

症状1: hook が /bin/sh: node: command not found(また brew/その他CLIも)

GUIから起動したClaude Code(.app)が spawn する hook の /bin/sh -c は、ログインシェルの プロファイル(.zshrc)を読まず 最小PATH(/usr/bin:/bin:/usr/sbin:/sbin) しか持たない。 nvm/homebrew にある node 等が見えず、プラグイン定義の node "...mjs" 系hookが毎回失敗する。

修正: ~/.claude/settings.json のトップレベルに env.PATH を足し、hook子プロセスに継承させる。

"env": {
  "PATH": "/Users/<you>/.nvm/versions/node/<ver>/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/<you>/.local/bin"
}

Bashツール側はプロファイルを再読込するので pyenv/nvm の順序は壊れない(env.PATHは hook など プロファイル非読込の子にだけ効く)。nvm versioned path が将来stale化しても /opt/homebrew/bin/node が fallback するので壊れない。

症状2: スクリプトの timeout 60 ... が効かない(timeout: command not found

macOSは GNU coreutils の timeout標準搭載しない。ECCのhooks.md等が前提にしていても不発。

修正: brew install coreutilsgtimeout が入る。スクリプトは command -v gtimeout >/dev/null && TIMEOUT_CMD="gtimeout 60" の形で優先検出させる (post_tsc_check.sh / skills-auto-update.sh はこの形。coreutils導入だけで設計通りに起動する)。

Pitfalls

  • env.PATH短すぎる値にするとin-sessionのBashが影響を受けうるので、ログインPATHの主要dirを網羅した superset にする。設定前に cp settings.json backups/ でバックアップ。
  • settings.json はプラグイン(例: agentmemory/remember)がライブ書換することがある。Edit前に再Readして楽観ロックに従う。env ブロックはjq round-tripでも保全される。
  • nvm の versioned path をハードコードすると node メジャー更新でstaleになる → 必ず /opt/homebrew/bin も含める。

Verification

# 旧最小PATHで再現(not found が出る)
env -i HOME="$HOME" /bin/sh -c 'PATH="/usr/bin:/bin"; node --version'
# 新env.PATHで解決(バージョンが出る)
env -i HOME="$HOME" /bin/sh -c 'PATH="<settings.jsonのenv.PATH>"; node --version && command -v node'
# timeout
command -v gtimeout && echo "post_tsc_check 等の timeout 分岐が起動する"
jq -e . ~/.claude/settings.json >/dev/null && echo "settings.json VALID"

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.