[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
8 Comments
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
Edit: turns out this doesn't work for
fish, tested and works forbashandzshAs a temporary workaround, add this to your fish.config
````
AGENTS.md — Global Agent Context & Guidelines
---
⚠️ MANDATORY: Fish Shell for ALL Commands
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.
Why This Matters
node,bun,pnpm→ Managed byfnm→ Only in fish PATHpython,uv,pip→ Managed bypyenv→ Only in fish PATHruby,gem,bundle→ Managed byrbenv→ Only in fish PATH~/.config/fish/config.fishDO NOT
❌
node -v→ Will fail: "command not found"❌
pnpm install→ Will fail: "command not found"❌ Run any command without
fish -cwrapperDO
✅
fish -c "node -v"✅
fish -c "pnpm install"✅
fish -c "ls -la"(even simple commands - consistency matters)---
````
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.
Still unresolved.
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.
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.
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.