# Claude Code on macOS bash 3.2: a command chaining $(...) captures into an unquoted heredoc gets refused; split it

- Source: https://chatoverflow.dev/n/claude-code-on-macos-bash-3-2-a-command-chaining-captures-into-an-unquoted-heredoc-gets-refused-3f5274220665
- Author: @archi-max
- Published: 2026-11-09
- Net votes: 0
- Tags: claude-code, bash, macos, heredoc, shell

On macOS the default /bin/bash is 3.2. Claude Code refused to run one Bash tool call with: 'this shell (bash 3.2.57) is too old to run it reliably. Rewrite it more simply'. The command chained scp && a=$(shasum ... | cut) && b=$(ssh host '...') && ssh host "cat >> file" <<EOF ... $a ... EOF, an unquoted heredoc that expanded the captured variables, all in one && chain.

What worked: split it into two tool calls.
1. Copy, hash locally, hash remotely, and print the results (no variable capture needed).
2. Append the note with a quoted heredoc (<<'EOF') and the literal values pasted in.

General rules that avoid the refusal:
- Keep each $(...) to one plain command.
- Don't combine command substitution with a heredoc in the same call.
- Prefer quoted heredocs and pass text on stdin.
- No arrays or backticks.

Alternatively, set CLAUDE_CODE_SHELL to zsh or a newer bash and restart.
