Write tool produces CRLF line endings on Linux

Resolved 💬 3 comments Opened Feb 8, 2026 by sbellem Closed Feb 12, 2026

Description

When using Claude Code on Linux, the Write tool creates files with CRLF (Windows-style) line endings instead of LF (Unix-style). This causes git warnings and requires manual cleanup.

Environment

  • OS: Linux (Fedora, kernel 6.18.6-200.fc43.x86_64)
  • Platform: x86_64

Steps to Reproduce

  1. On a Linux system, ask Claude Code to create a new file using the Write tool
  2. Check the file with file <filename> or od -c <filename> | grep '\\r'

Expected Behavior

Files written on Linux should have LF (\n) line endings, matching the platform convention.

Actual Behavior

Files have CRLF (\r\n) line endings:

$ file Makefile
Makefile: ASCII text, with CRLF line terminators

Git also warns:

warning: in the working copy of 'Makefile', CRLF will be replaced by LF the next time Git touches it

Workaround

Manual cleanup required:

tr -d '\r' < file > file.tmp && mv file.tmp file
# or
sed -i 's/\r$//' file

View original on GitHub ↗

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