[BUG] Write/Edit tools create CRLF line endings on macOS (constantly recurring)

Resolved 💬 3 comments Opened Jan 19, 2026 by dubbstarr Closed Jan 22, 2026

Describe the bug

Claude Code's Write and Edit tools consistently create files with CRLF (Windows) line endings on macOS, despite the platform expecting LF line endings. This is a constantly recurring issue requiring frequent manual intervention.

Environment

  • Claude Code Version: 2.1.12
  • Platform: macOS (darwin 25.2.0)
  • Shell: zsh

Affected Files
All file types, including:

  • Shell scripts (~/.claude/bin/launch-claude-agents)
  • Config files (~/.tmux.conf)
  • User reports: "constantly an issue"

Evidence from command log:

2026-01-06 13:57:50 - sed -i '' 's/\r$//' ~/.claude/bin/launch-claude-agents
2026-01-06 15:14:39 - sed -i '' 's/\r$//' ~/.tmux.conf

Impact

  • Shell scripts fail to execute (CRLF breaks shebang)
  • Config files malfunction
  • Interrupts workflow with "Let me fix the line endings" messages
  • Requires manual sed commands to correct

Expected Behavior
On Unix-like systems (macOS, Linux), Write/Edit tools should create files with LF line endings, not CRLF.

Related Issues

  • #2805 - Claude Code creates CRLF on Linux (also affects macOS)
  • #13456 - Edit tool fails on files with CRLF
  • #12945 - Edit tool "File has been unexpectedly modified" on Windows

Workaround
Implementing a PostToolUse hook to auto-detect and convert CRLF → LF after every Write/Edit operation (workaround available if needed).

Request
Fix Write/Edit tools to respect platform line ending conventions:

  • Windows: CRLF
  • macOS/Linux: LF

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗