macos-hook-path-timeout
Skill0 starsChanged 5 months agoMITView on GitHub
macOSでClaude Codeのhookやlaunchdジョブが `node: command not found` / `timeout: not found` で失敗する時に使う。GUI起動アプリの最小PATH問題と、macOSにGNU coreutils(timeout)が無い問題の、検証済み回避策。
- Installs packages
In this repository99 other files it gives its agents.
- agents-tools-quoted-jsonSkill
- asc-api-app-store-submitSkill
- asd-ste100Skill
- automation-bool-selector-pitfallsSkill
- automation-stale-cooldown-flagSkill
- autonomous-build-verifySkill
- book-to-skillSkill
- ccusage-cli-cost-trackingSkill
- chrome-ext-mv3-programmatic-injectSkill
- chrome-ext-store-assetsSkill
- claude-headless-p-invocationSkill
- claude-plugin-context-auditSkill
- claude-session-log-to-kbSkill
- cloudflare-workers-do-deploySkill
- codebase-to-courseSkill
- codesign-keychain-prompt-fixSkill
- codex-cli-setupSkill
- codex-delegation-handoffSkill
- content-factory-grounding-dedupSkill
- conversation-log-append-patternSkill
- cron-to-launchd-macosSkill
- cross-automation-shared-resource-killSkill
- design-token-migration-rnSkill
- discord-bot-image-to-claudeSkill
- discord-gateway-resume-dedupSkill
- excel-filtered-url-http-auditSkill
- execution-budget-vs-capsSkill
- expo-free-local-ios-testflightSkill
- ga4-connect-projectsSkill
- gcal-oauth-desktop-setupSkill
- git-commit-helperSkill
- git-prepush-secret-remote-checkSkill
- gsc-cli-automationSkill
- hatena-blogsync-autopostSkill
- hook-latency-wrapSkill
- hook-log-append-patternSkill
- html-to-pdf-slide-deckSkill
- humanizerSkill
- human-review-gate-shellSkill
- implementation-model-routingSkill
- insights-to-claude-mdSkill
- ios-permission-key-security-matrixSkill
- ios-sim-store-screenshotsSkill
- launchd-exit78-exconfig-debugSkill
- llm-content-pipeline-quality-gateSkill
- local-ai-video-pipelineSkill
- local-flux-mflux-image-genSkill
- local-llm-slow-diagnosisSkill
- local-music-generationSkill
- lottie-skottie-authoring-pitfallsSkill
- machine-wide-api-ratelimit-latchSkill
- md-to-docx-reportSkill
- memory-md-inject-bloat-auditSkill
- message-display-secrets-maskSkill
- metric-source-attributionSkill
- migrate-icloud-desktop-assetsSkill
- nextauth-local-e2e-sessionSkill
- nextjs-rsc-payload-slimSkill
- nothing-designSkill
- openclaw-ollama-setupSkill
- The first 60 shown.
The file
Files
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 coreutils で gtimeout が入る。スクリプトは
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"Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

