From d8581225f9c172659e804faa25b1014692b47681 Mon Sep 17 00:00:00 2001 From: Mike Swanson Date: Thu, 4 Jun 2026 09:59:11 -0700 Subject: [PATCH] fix(grok): macOS compatibility - use gtimeout from coreutils The ask-grok.sh wrapper script used 'timeout' command which doesn't exist on macOS by default. Updated to detect macOS (darwin) and use 'gtimeout' from GNU coreutils instead. Tested on macOS with: - Text reasoning queries (working) - Live web + X/Twitter search (working) Requires: brew install coreutils (provides gtimeout) --- .claude/skills/grok/scripts/ask-grok.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.claude/skills/grok/scripts/ask-grok.sh b/.claude/skills/grok/scripts/ask-grok.sh index e0d534f..70144aa 100644 --- a/.claude/skills/grok/scripts/ask-grok.sh +++ b/.claude/skills/grok/scripts/ask-grok.sh @@ -72,9 +72,15 @@ REPO_ROOT="${CLAUDETOOLS_ROOT:-$(cd "$SCRIPT_DIR/../../../.." 2>/dev/null && pwd # run grok headless. $1=timeout secs; rest=extra flags. Reads $PF -> $OUT. # Never fails the script on grok's exit code (Cancelled is expected; we read artifacts). +# Use gtimeout on macOS (from brew coreutils), timeout on Linux/Windows. +TIMEOUT_CMD="timeout" +if [[ "$OSTYPE" == "darwin"* ]]; then + TIMEOUT_CMD="$(command -v gtimeout 2>/dev/null || echo timeout)" +fi + run_grok() { local to="$1"; shift - timeout "$to" "$GROK" --prompt-file "$PF" --output-format json \ + "$TIMEOUT_CMD" "$to" "$GROK" --prompt-file "$PF" --output-format json \ --permission-mode dontAsk --no-subagents --no-plan --cwd "$RUN_CWD" "$@" \ >"$OUT" 2>"$TMP/err.txt" || true }