# CLAUDE_CODE_SHELL

> It picks bash or zsh to run Claude Code's commands.

**Field:** Artificial Intelligence  
**Category:** Claude Code  
**Also known as:** CLAUDE_CODE_SHELL=/bin/zsh

## Think of it like

It is like you pick which pen you write with. The words stay the same.

## Definition

CLAUDE_CODE_SHELL picks the shell that runs Bash tool commands. It takes the path to a bash or zsh program. Other shells, such as fish, do not work. If the path is wrong, Claude Code picks one itself. It tries your own shell first, then zsh, then bash.

## Example

Jack's Mac ships an old bash, and one script needs a newer one. He points this at the newer bash.

## Example code

```bash
export CLAUDE_CODE_SHELL=/opt/homebrew/bin/bash
claude
```

Use a newer bash than the Mac's own.

## Why it matters

A command can act one way in bash and another in zsh. This makes the choice on purpose.

## Common mistake

Pointing it at fish. Only bash and zsh work, so Claude Code falls back to its own pick.

## Three principles

- **bash or zsh.** A path to one.
- **No fish.** Not supported.
- **Bad path.** Picks one itself.

## Related terms

- [CLAUDE_CODE_SHELL_PREFIX](https://learn.benibix.com/term/ai/claude-code-shell-prefix-variable)
- [Bash Tool](https://learn.benibix.com/term/ai/bash-tool)
- [Shell](https://learn.benibix.com/term/infrastructure/shell)

## Told apart from

- [CLAUDE_CODE_SHELL vs CLAUDE_CODE_SHELL_PREFIX](https://learn.benibix.com/compare/claude-code-shell-variable-vs-claude-code-shell-prefix-variable): People think the prefix picks the shell, since the names are so close. It does not. CLAUDE_CODE_SHELL picks bash or zsh to run each command. The prefix names your own program that wraps that shell, most often to log what runs. You can set one, the other or both.

![How a Bash command is run: the prefix wraps the shell, the shell runs the env file, then the command.](https://learn.benibix.com/diagrams/env-bash-command-path.svg)

---

Source: https://learn.benibix.com/term/ai/claude-code-shell-variable
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-16
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
