cygpath command not found in Git Bash (MINGW64) on Windows

Resolved 💬 3 comments Opened Jan 29, 2026 by pluto2060 Closed Feb 1, 2026

Bug Report: cygpath command not found in Git Bash (MINGW64) on Windows

Environment

  • OS: Windows (MINGW32_NT-6.2 1.0.19(0.48/3/2))
  • Shell: Git Bash (MINGW64)
  • Claude Code Version: (CLI 버전 확인 불가 - PATH 미설정)
  • Node.js: v24.12.0
  • Git: v2.52.0.windows.1

Description

When using Claude Code in Git Bash (MINGW64) environment on Windows, certain commands (Bash, Grep tools) fail with the following error:

Error: Command failed: cygpath -u 'C:\Users\Jayone\AppData\Local\Temp'

Root Cause

Claude Code internally calls the Cygwin-specific utility cygpath to convert Windows paths to Unix paths.

Git for Windows (MINGW64) does not include cygpath, causing the error.

Reproduction Steps

  1. Use Windows with Git Bash (MINGW64) environment
  2. Run Claude Code CLI
  3. Execute commands that involve path conversion:

```bash
# Using Bash tool
claude> git status --short | grep ontology

# Using Grep tool
claude> [Search files with Grep tool]
```

  1. Error occurs: Command failed: cygpath -u '...'

Expected Behavior

  • Path conversion should work properly in Git Bash (MINGW64) environment
  • Claude Code should use cross-platform path conversion methods without Cygwin dependency

Actual Behavior

  • cygpath command not found, causing error
  • Bash, Grep, and other tools requiring path conversion fail

Suggested Fix

Option 1: Use Node.js path module (Recommended)

// Current (Cygwin-dependent)
const unixPath = execSync(`cygpath -u '${windowsPath}'`).toString().trim();

// Fixed (Node.js built-in module)
const path = require('path');
const unixPath = windowsPath.split('\\').join('/');
// or
const unixPath = path.posix.normalize(windowsPath.replace(/\\/g, '/'));

Option 2: Conditional handling based on shell detection

const isGitBash = process.env.SHELL?.includes('bash');
const isCygwin = process.platform === 'win32' && fs.existsSync('/usr/bin/cygpath');

if (isCygwin) {
  // Use cygpath
} else {
  // Use Node.js path module
}

Option 3: Shell auto-detection with user warning

// Warn user when Git Bash is detected
if (isGitBash && !commandExists('cygpath')) {
  console.warn('⚠️ Git Bash detected. For better compatibility, consider using PowerShell or CMD.');
}

Workaround (Temporary Solution)

Current workarounds available for users:

  1. Use PowerShell (Recommended)

``powershell
# Run Claude Code in PowerShell
claude-code
``

  1. Use CMD

``cmd
claude-code
``

  1. Use WSL environment

``bash
# Install and run in WSL (Ubuntu, etc.)
npm install -g @anthropic-ai/claude-code
claude-code
``

Impact

  • Severity: Medium
  • Affected Users: Windows users using Git Bash (MINGW64) environment
  • Workaround Available: Yes (Use PowerShell/CMD/WSL)

Additional Context

  • Git for Windows is based on MSYS2/MINGW64, which uses a different runtime than Cygwin
  • cygpath is a Cygwin-specific utility and is not included in Git Bash
  • Node.js path module supports cross-platform path handling, eliminating external command dependencies

System Information

OS: MINGW32_NT-6.2 1.0.19(0.48/3/2)
Node.js: v24.12.0
Git: v2.52.0.windows.1
Shell: Git Bash (MINGW64)

Related Issues

[Link related issues if any]

View original on GitHub ↗

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