[Feature Request] Add support for fish shell integration

Status Closed — not planned
Maintainer reply None cached
Activity 8 comments · opened Dec 9, 2025 · closed Feb 11, 2026

Title: Fish shell support via CLAUDE_CODE_SHELL_PREFIX incompatible with zsh shell snapshots

Description:

When using CLAUDE_CODE_SHELL_PREFIX to run commands in fish shell, all commands fail with syntax errors because Claude Code sources zsh-format shell snapshots that are incompatible with fish syntax.

Steps to Reproduce:

  1. Set fish as system default shell: chsh -s /usr/local/bin/fish (or /opt/homebrew/bin/fish on ARM Mac)
  2. Add to ~/.claude/settings.json:

``json
{
"env": {
"CLAUDE_CODE_SHELL_PREFIX": "/usr/local/bin/fish -c"
}
}
``

  1. Start Claude Code
  2. Run any Bash command (e.g., ls, echo "test")

Expected Behavior:

Commands should execute cleanly in fish shell without errors.

Actual Behavior:

Every command fails with syntax errors:

~/.claude/shell-snapshots/snapshot-zsh-*.sh (line 183): Unexpected '}' found, expecting ')'
source: Error while reading file '~/.claude/shell-snapshots/snapshot-zsh-*.sh'
fish: Unknown command: /var/folders/.../claude-*-cwd

Commands still execute and produce output after the errors, but the error messages make the output noisy and unusable.

Root Cause:

Claude Code creates and sources shell snapshot files in zsh/bash syntax (stored in ~/.claude/shell-snapshots/) before each command execution. These snapshots preserve shell state (functions, aliases, environment variables) across commands.

When CLAUDE_CODE_SHELL_PREFIX is set to fish, the infrastructure still attempts to source existing zsh-format snapshots, causing fish to fail on zsh-specific syntax like:

  • emulate -L zsh
  • setopt extendedglob
  • local -a arrays
  • Bash-style function definitions

Impact:

CLAUDE_CODE_SHELL_PREFIX is completely unusable for fish shell users, forcing them to use zsh/bash instead. Every command produces error output before the actual results, making the tool difficult to use.

Suggested Fix:

One or more of the following:

  1. Shell-aware snapshots: Detect the target shell via CLAUDE_CODE_SHELL_PREFIX and generate shell-specific snapshot formats (fish syntax for fish, zsh syntax for zsh, etc.)
  1. Skip snapshots for fish: Don't source snapshots when using fish shell, or create a minimal fish-compatible snapshot format
  1. Document limitations: Clearly document that only bash/zsh are fully supported, and that CLAUDE_CODE_SHELL_PREFIX should not be used with fish
  1. Native shell setting: Add a first-class shell configuration option in settings.json with proper multi-shell support, rather than relying on the CLAUDE_CODE_SHELL_PREFIX environment variable workaround

Environment:

  • OS: macOS
  • Default shell: fish
  • Claude Code version: 2.0.62

View original on GitHub ↗

8 Comments

github-actions[bot] · 8 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/13144
  2. https://github.com/anthropics/claude-code/issues/7490
  3. https://github.com/anthropics/claude-code/issues/11475

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

AbdelrahmanHafez · 8 months ago

Edit: turns out this doesn't work for fish, tested and works for bash and zsh
As a temporary workaround, add this to your fish.config

function claude
  SHELL="/opt/homebrew/bin/fish" command claude $argv
end
gastonmorixe · 8 months ago
~/.claude/CLAUDE.md

````

AGENTS.md — Global Agent Context & Guidelines

---

⚠️ MANDATORY: Fish Shell for ALL Commands

CRITICAL RULE — READ BEFORE ANY COMMAND EXECUTION

The Bash tool executes in zsh/bash. Your environment (fnm, pyenv, bun, etc.) exists ONLY in fish.

🐟 THE RULE: ALWAYS use fish -c "command"

EVERY command. No exceptions. No thinking required.

# Pattern
fish -c "your command here"

# Examples
fish -c "node -v"
fish -c "pnpm install"
fish -c "bun run dev"
fish -c "python --version"
fish -c "git status"
fish -c "ls -la"

Why This Matters

  • node, bun, pnpm → Managed by fnm → Only in fish PATH
  • python, uv, pip → Managed by pyenv → Only in fish PATH
  • ruby, gem, bundle → Managed by rbenv → Only in fish PATH
  • Environment variables → Set in ~/.config/fish/config.fish

DO NOT

node -v → Will fail: "command not found"
pnpm install → Will fail: "command not found"
❌ Run any command without fish -c wrapper

DO

fish -c "node -v"
fish -c "pnpm install"
fish -c "ls -la" (even simple commands - consistency matters)

---

````

github-actions[bot] · 7 months ago

This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.

AbdelrahmanHafez · 7 months ago

Still unresolved.

github-actions[bot] · 6 months ago

This issue has been automatically closed due to 60 days of inactivity. If you're still experiencing this issue, please open a new issue with updated information.

marcindulak · 6 months ago

This issue was closed incorrectly despite recent human comments. This behavior of the bot is reported at https://github.com/anthropics/claude-code/issues/16497. Please upvote that issue, so maybe it gets noticed.

github-actions[bot] · 6 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.