Skip to content

Claude Code CLI Not Found Despite Being Installed #978

Description

@coygeek

Checklist

  • I searched existing issues and this hasn't been reported

Area

Frontend

Operating System

macOS

Version

2.7.3 official release

What happened?

When using Auto-Claude v2.7.3 on macOS (Apple Silicon), the "Planning" phase fails with repeated errors:

Agent error: Claude Code not found. Install with: npm install -g @anthropic-ai/claude-code
If already installed locally, try: export PATH="$HOME/node_modules/.bin:$PATH"
Or provide the path via ClaudeAgentOptions: ClaudeAgentOptions(cli_path='/path/to/claude')

However, Claude Code IS installed and accessible from the terminal:

$ which claude
/opt/homebrew/bin/claude

$ claude --version
2.1.5 (Claude Code)

Root Cause Analysis

The issue is a PATH environment variable inheritance problem between the Electron frontend and Python backend:

  1. Claude CLI is installed via Homebrew at /opt/homebrew/bin/claude

  2. The Electron frontend has awareness of this issue and includes /opt/homebrew/bin in COMMON_BIN_PATHS (see apps/frontend/src/main/env-utils.ts):

    export const COMMON_BIN_PATHS: Record<string, string[]> = {
      darwin: [
        '/opt/homebrew/bin',      // Apple Silicon Homebrew
        // ...
      ],
    };
  3. The Python backend uses the Claude Agent SDK (claude_agent_sdk package) which spawns the Claude CLI as a subprocess. The create_client() function in apps/backend/core/client.py does NOT pass a cli_path parameter to ClaudeAgentOptions:

    options_kwargs = {
        "model": model,
        "system_prompt": base_prompt,
        # ... other options
        # NOTE: No cli_path parameter!
    }
    return ClaudeSDKClient(options=ClaudeAgentOptions(**options_kwargs))
  4. When the Electron app spawns the Python subprocess, the subprocess does NOT inherit the user's shell environment (this is standard macOS behavior for GUI apps launched from Finder/Dock).

  5. The Claude Agent SDK tries to find claude in PATH, but /opt/homebrew/bin is not in the subprocess's PATH.

Why the Frontend Works But Backend Doesn't

The frontend TypeScript code properly augments PATH before spawning processes:

// apps/frontend/src/main/env-utils.ts
/**
 * Common issue: `gh` CLI installed via Homebrew is in /opt/homebrew/bin
 * which isn't in PATH when the Electron app launches from Finder/Dock.
 */

But this PATH augmentation is NOT passed through to the Python backend subprocess, and the Python backend doesn't do its own PATH augmentation.


Steps to reproduce

  1. Install Claude Code via Homebrew: brew install claude-code (or equivalent)
  2. Verify installation: which claude shows /opt/homebrew/bin/claude
  3. Open Auto-Claude desktop app (launch from Dock or Finder, NOT from terminal)
  4. Open a project
  5. Create a new task in the Kanban board
  6. Click "Start Executing" button
  7. During the "Planning" phase, observe the error:
    Agent error: Claude Code not found. Install with: npm install -g @anthropic-ai/claude-code
    

Note: If you launch Auto-Claude from the terminal (e.g., npm run start), it may work because terminal sessions inherit the shell's PATH which includes /opt/homebrew/bin.


Expected behavior

Auto-Claude should:

  1. Detect Claude CLI installed via Homebrew at /opt/homebrew/bin/claude
  2. Pass the detected path to the Python backend (either via environment variable or command-line argument)
  3. Pass cli_path in ClaudeAgentOptions when creating the SDK client
  4. OR the Python backend should perform its own PATH augmentation to include common binary locations

Environment

  • macOS: Apple Silicon (M-series)
  • Auto-Claude version: 2.7.3
  • Claude Code version: 2.1.5
  • Claude CLI location: /opt/homebrew/bin/claude
  • Installation method: Homebrew

Suggested Fix

In apps/backend/core/client.py, the create_client() function should accept and pass through a cli_path parameter:

def create_client(
    project_dir: Path,
    spec_dir: Path,
    model: str,
    agent_type: str = "coder",
    max_thinking_tokens: int | None = None,
    output_format: dict | None = None,
    agents: dict | None = None,
    cli_path: str | None = None,  # NEW PARAMETER
) -> ClaudeSDKClient:
    # ...

    options_kwargs = {
        "model": model,
        # ... existing options
    }

    # Pass cli_path if provided
    if cli_path:
        options_kwargs["cli_path"] = cli_path

    return ClaudeSDKClient(options=ClaudeAgentOptions(**options_kwargs))

And the Electron frontend should:

  1. Detect the Claude CLI path using its existing getToolPath('claude') function
  2. Pass this path to the Python backend via environment variable (e.g., CLAUDE_CLI_PATH)
  3. The Python backend should read this environment variable and pass it to create_client()

Alternative: The Python backend could do its own PATH augmentation before calling the Claude Agent SDK, similar to what the frontend does.


Workaround

Until fixed, users can try:

  1. Launch Auto-Claude from terminal instead of Dock/Finder:

    cd /path/to/auto-claude
    npm run start
  2. Configure Claude CLI path in settings (if available):

    • Go to Settings > Paths
    • Set "Claude CLI Path" to /opt/homebrew/bin/claude
  3. Create a symlink in a location that IS in PATH:

    sudo ln -s /opt/homebrew/bin/claude /usr/local/bin/claude

Logs / Screenshots

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Status
    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions