[BUG] Platform reported as "darwin" / Shell "zsh" under Git Bash (MSYS) on Windows 11
Summary
When running Claude Code inside Git Bash / MSYS on Windows 11, the environment block injected into the session reports Platform: darwin and Shell: zsh. The machine is Windows 11 with no macOS whatsoever. This causes the model to mis-judge the environment (e.g. assuming macOS paths/shell, or that D:\ drives are inaccessible), leading it to use wrong path conventions and refuse valid operations.
Environment
- OS: Windows 11 (build 26200)
- Shell: Git Bash / MSYS (MINGW64)
- Claude Code version: 2.1.170
- Node: v24.12.0
Real environment values (from the shell Claude Code itself runs in):
$ uname -a
MINGW64_NT-10.0-26200 Maxwell-OMEN 3.6.6-1cdd4371.x86_64 2026-01-15 22:20 UTC x86_64 Msys
$ echo $OSTYPE
msys
$ echo $MSYSTEM
MINGW64
Actual behavior
The session environment block contains:
Platform: darwin
Shell: zsh
These are macOS defaults. darwin + zsh appear together as a set, which strongly suggests the platform-detection logic fails to recognize the MSYS/MINGW environment and falls back to hard-coded macOS default values.
Expected behavior
On Git Bash / MSYS, Claude Code should detect the environment from uname -s (which contains MINGW64_NT / MSYS_NT) and/or $OSTYPE (msys) and $MSYSTEM (MINGW64), and report the platform as Windows (MSYS/MinGW) with the correct shell (bash), instead of falling back to darwin / zsh.
Impact
Because the injected environment block claims macOS, the model:
- assumes macOS-style paths and shell semantics;
- can wrongly conclude Windows drives (e.g.
D:\) are inaccessible, when in fact they are reachable via/c/,/d/under MSYS; - adopts incorrect path conventions (
D:\...vs/d/...).
This is closely related to #9883 (MSYS environment not recognized, cygpath handling), but the specific symptom here is the platform/shell metadata being reported as darwin/zsh, which I could not find reported elsewhere.
Suggested fix
Detect MSYS/MinGW via uname -s (MSYS_NT / MINGW64_NT / MINGW32_NT) or $OSTYPE=msys / $MSYSTEM, and populate the environment block with the correct Windows-under-MSYS platform and bash shell, instead of the macOS fallback.
This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗