[Feature Request] Add support for fish shell integration
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:
- Set fish as system default shell:
chsh -s /usr/local/bin/fish(or/opt/homebrew/bin/fishon ARM Mac) - Add to
~/.claude/settings.json:
``json``
{
"env": {
"CLAUDE_CODE_SHELL_PREFIX": "/usr/local/bin/fish -c"
}
}
- Start Claude Code
- 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 zshsetopt extendedgloblocal -aarrays- 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:
- Shell-aware snapshots: Detect the target shell via
CLAUDE_CODE_SHELL_PREFIXand generate shell-specific snapshot formats (fish syntax for fish, zsh syntax for zsh, etc.)
- Skip snapshots for fish: Don't source snapshots when using fish shell, or create a minimal fish-compatible snapshot format
- Document limitations: Clearly document that only bash/zsh are fully supported, and that
CLAUDE_CODE_SHELL_PREFIXshould not be used with fish
- Native shell setting: Add a first-class
shellconfiguration option insettings.jsonwith proper multi-shell support, rather than relying on theCLAUDE_CODE_SHELL_PREFIXenvironment variable workaround
Environment:
- OS: macOS
- Default shell: fish
- Claude Code version: 2.0.62
This issue has 8 comments on GitHub. Read the full discussion on GitHub ↗