Hook scripts shipped with CRLF line endings → "/bin/bash^M: bad interpreter" on macOS/Linux

Open Beginner friendly
#63 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
68/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
git, shell
Domain
release, tooling

Research direction

Start with the 14 shell files listed under scripts/ and scripts/legacy/, then check whether the repository has a .gitattributes file. Verify the current terminators with file or od, convert the scripts to LF, and add the stated attribute if needed. Done means all shipped .sh files use LF and their shebangs no longer produce the /bin/bash^M failure on macOS/Linux.

Written by the indexing model from the issue text.

Description

Summary

All shell scripts in the warp plugin (v2.1.0) are shipped with Windows CRLF (\r\n) line endings. On macOS/Linux the carriage return becomes part of the shebang, so the OS looks for an interpreter literally named /bin/bash\r and the hook fails:

Failed with non-blocking status code: /bin/sh:
/Users/<me>/.claude/plugins/cache/claude-code-warp/warp/2.1.0/scripts/on-post-tool-use.sh: /bin/bash^M: bad interpreter: No such file or directory
Affected files

Every .sh in scripts/ and scripts/legacy/ (14 files) has CRLF terminators, e.g.:

  • scripts/on-post-tool-use.sh
  • scripts/on-notification.sh
  • scripts/on-permission-request.sh
  • scripts/on-prompt-submit.sh
  • scripts/on-session-start.sh
  • scripts/on-stop.sh
  • scripts/warp-notify.sh
  • scripts/build-payload.sh
  • scripts/emit-terminal-sequence.sh
  • scripts/should-use-structured.sh
  • scripts/legacy/*.sh

Confirmed via:

$ file scripts/on-post-tool-use.sh
... Bourne-Again shell script text executable, ASCII text, with CRLF line terminators
$ head -1 scripts/on-post-tool-use.sh | od -c
0000000   # ! / b i n / b a s h \r \n
Environment
  • Plugin: warp v2.1.0
  • OS: macOS (darwin, arm64); same failure mode applies to any Linux host
Suggested fix
  1. Re-commit all *.sh with LF line endings.

  2. Add a .gitattributes to keep them LF regardless of contributor platform / core.autocrlf:

    *.sh text eol=lf
    
Workaround

Strip the carriage returns locally (reverts on plugin reinstall):

find ~/.claude/plugins/cache/claude-code-warp -name '*.sh' -print0 | xargs -0 perl -i -pe 's/\r$//'
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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from warpdotdev/claude-code-warp

All issues in warpdotdev/claude-code-warp

Similar issues

More Shell/Bash issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.