claude-code - 💡(How to fix) Fix Feature Request: Support zsh as defaultShell for ! bang commands [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#49020Fetched 2026-04-17 08:53:05
View on GitHub
Comments
0
Participants
1
Timeline
3
Reactions
0
Author
Participants
Timeline (top)
labeled ×3
RAW_BUFFERClick to expand / collapse

Problem

Currently, Claude Code's settings.json only allows "defaultShell": "bash" or "powershell" for ! bang commands. On macOS (and many Linux setups), zsh is the default login shell, and users maintain all their aliases, PATH exports, plugins, and environment configurations in ~/.zshrc.

When using ! to run quick commands inside Claude Code, everything executes in bash, which:

  1. Does not load ~/.zshrc.
  2. Breaks user-defined aliases (e.g. alias ls="lsd").
  3. Creates a confusing experience for anyone whose daily workflow is built around zsh.

Request

Please add "zsh" as a valid option for "defaultShell" in settings.json (and ideally auto-detect $SHELL on macOS).

Use case

As a heavy zsh user, I want ! commands to run inside zsh so that my environment, aliases, and completions work consistently without having to prefix every command with zsh -c \"...\".

extent analysis

TL;DR

Adding "zsh" as a valid option for "defaultShell" in settings.json would allow users to run ! commands in their default shell, resolving issues with alias and environment configurations.

Guidance

  • Consider modifying the settings.json to include "zsh" as a valid option for "defaultShell" to support users who have zsh as their default shell.
  • To verify the fix, users can check if their aliases and environment configurations are loaded correctly when running ! commands.
  • The code could be updated to auto-detect the user's default shell by checking the $SHELL environment variable on macOS.
  • Users can temporarily workaround the issue by prefixing their commands with zsh -c \"...\", but this is not a permanent solution.

Example

{
  "defaultShell": "zsh"
}

This example shows how the settings.json file could be updated to use zsh as the default shell.

Notes

The solution assumes that the codebase is designed to handle different shell configurations. If the code is not compatible with zsh, additional modifications may be necessary.

Recommendation

Apply workaround: until the code is updated to support zsh, users can use the zsh -c \"...\" prefix to run commands in their default shell.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix Feature Request: Support zsh as defaultShell for ! bang commands [1 participants]