Hook scripts break BASH_ENV on macOS: hardcoded #!/bin/bash forces bash 3.2
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 84/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Quiet
- Tech stack
- bash
- Domain
- devtools
Research direction
Review the .sh files listed under plugins/warp/scripts/ and plugins/warp/scripts/legacy/, checking each shebang and the related issue #60 for context. Verify that every affected hook uses the intended environment-resolved Bash entry point, then confirm no hardcoded /bin/bash shebangs remain in those directories.
Written by the indexing model from the issue text.
Description
Summary
All hook scripts use #!/bin/bash as their shebang. On macOS, /bin/bash is permanently pinned to bash 3.2.57 (Apple won't ship newer versions due to GPLv3 licensing). Users who install a modern bash (4.x/5.x) via Homebrew or similar have their $PATH configured to use the newer version, but the hardcoded shebang bypasses $PATH entirely.
When bash runs a script (non-interactive shell), it sources $BASH_ENV if set. Because the hooks force /bin/bash 3.2, $BASH_ENV gets sourced under bash 3.2 instead of the user's expected bash version. Any bash 4+ or 5+ features in the $BASH_ENV target file will fail or behave unexpectedly.
How it breaks
- User has bash 5.x installed (e.g.
/opt/homebrew/bin/bash) and$PATHprioritizes it - User has
$BASH_ENVset, pointing to a file that uses modern bash features - Claude Code hook fires → kernel sees
#!/bin/bash→ launches/bin/bash(3.2.57) - Bash 3.2 inherits the environment, sees
$BASH_ENV, and sources the file - Modern bash features fail under 3.2 (associative arrays,
${var,,},|&,readarray,declare -g, etc.)
Reproduction
# Confirm macOS system bash version
/bin/bash --version
# GNU bash, version 3.2.57(1)-release (arm64-apple-darwin...)
# Confirm user's actual bash
bash --version
# GNU bash, version 5.2.37(1)-release ...
# If BASH_ENV is set and its target uses any bash 4+ feature,
# hook scripts will error or produce unexpected behavior
echo $BASH_ENV
Affected files
All .sh scripts under plugins/warp/scripts/ and plugins/warp/scripts/legacy/:
on-post-tool-use.shon-session-start.shon-prompt-submit.shon-stop.shon-permission-request.shon-notification.shbuild-payload.shemit-terminal-sequence.shshould-use-structured.shwarp-notify.shlegacy/on-session-start.shlegacy/on-stop.shlegacy/on-notification.shlegacy/warp-notify.sh
Fix
Replace #!/bin/bash with #!/usr/bin/env bash in all scripts:
find plugins/warp/scripts/ -name "*.sh" -exec sed -i '' 's|^#!/bin/bash|#!/usr/bin/env bash|' {} +
This ensures the user's $PATH-resolved bash is used, so $BASH_ENV is sourced by the correct version.
Related
- #60 — Same root cause (hardcoded shebang), different manifestation (NixOS has no
/bin/bashat all)
Environment
- OS: macOS (Apple Silicon)
/bin/bash: 3.2.57- User's bash: 5.2.37 (Homebrew)
- Claude Code: latest
- Plugin: claude-code-warp latest
- Dominant language
- Shell
- Stars
- 231
- Forks
- 56
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from warpdotdev/claude-code-warp
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
warpdotdev/claude-code-warp#63 · 2 comments ·
-
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
warpdotdev/claude-code-warp#61 · 5 comments · 3 reactions ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
warpdotdev/claude-code-warp#60 · 1 comment ·
All issues in warpdotdev/claude-code-warp
Similar issues
-
docs(agents): strengthen the no-backslash-escaped-backticks rule with an issue-creation example Open
Difficulty 1/5 Under an hour Newbie friendliness 92/100
-
package-update
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
oSoWoSo/vOid_Community_repOsitory#148 · 1 comment ·
-
chore
Difficulty 1/5 Under an hour Newbie friendliness 91/100
alunduil/alunduil-chezmoi#792 ·
-
area: compat bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
zenhub-dev
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
OpenLiberty/ci.docker#747 ·