• AgentArmorHQ teamTeam5d agoNeeds help

    Why does Claude Code's Bash tool use zsh instead of my fish shell?

    On macOS, Claude Code's Bash tool keeps running /bin/zsh even when Claude is launched from fish, so PATH entries and aliases from the fish config are missing. Launching with SHELL=/opt/homebrew/bin/fish does not change this. How can the Bash tool run commands in fish, and why is it ignored?

    Originally asked on GitHub: https://github.com/anthropics/claude-code/issues/7490

    4 answers

    • Best answerAgentArmorHQ teamTeam5d ago

      Status: open. This is a feature request with no official fix in the thread, and Claude Code does not currently let you choose the Bash tool shell.

      What the thread shows:

      • Launching with SHELL=/opt/homebrew/bin/fish claude still results in the Bash tool running /bin/zsh.
      • Setting fish as the login shell with chsh -s did not change this for one user.
      • Running SHELL=/bin/bash claude makes the Bash tool use bash.
      • A commenter who inspected the minified package reported that the selection logic accepts bash and zsh as preferred shells and otherwise falls back to zsh, then bash. Fish is not in that list. This is the commenter's reading of the code, not an official explanation.

      Workarounds mentioned in the thread:

      • Run commands through fish explicitly with fish -c '<command>'. This works, but one user reported that each such command then needed manual approval, and the root command shown to the permission system is fish.
      • Start Claude Code from a fish session so that PATH and other variables set by fish init files are inherited. In VS Code, another commenter suggested setting the integrated terminal default profile to fish and enabling the inherit-env setting.

      General advice: when the Bash tool runs under zsh, avoid bash-only syntax in ad-hoc scripts, and state the target shell explicitly in prompts.

      Did this work for you?
    • AgentArmorHQ teamTeam5d ago

      What a GitHub user tried on GitHub (Partly worked)

      Launched with SHELL=/opt/homebrew/bin/fish claude and asked it to echo $SHELL; the Bash tool reported /bin/zsh. The reporter then used fish -c to find and remove an MCP server, which worked for that task.

      Source: https://github.com/anthropics/claude-code/issues/7490 (opens external site)

      Did this work for you?
    • AgentArmorHQ teamTeam5d ago

      What @riordanpawley tried on GitHub (Partly worked)

      Used fish -c wrappers for fd and rg commands, but each one required manual approval. Switched to opencode as a replacement.

      Source: https://github.com/anthropics/claude-code/issues/7490#issuecomment-3283676788 (opens external site)

      Did this work for you?
    • AgentArmorHQ teamTeam5d ago

      What @DanilAgafonov tried on GitHub (Didn't work)

      Set fish as the default login shell with chsh -s and ran claude from fish; Claude Code still used /bin/zsh. Running SHELL=/bin/bash claude made it use bash.

      Source: https://github.com/anthropics/claude-code/issues/7490#issuecomment-3474958471 (opens external site)

      Did this work for you?

    Add your answer or comment