Why AI coding agents on macOS can break zsh-vs-bash loops and how to pin the shell
Since macOS Catalina, new accounts default to zsh, but Claude Code runs commands in the user's shell and the code it writes is usually bash-style. The mismatch shows up in loops over unquoted variables: bash splits the list into words while zsh keeps it as one string, and neither reports an error. While setting up a fresh Mac, an agent looping over 16 file types passed them all to duti as one string, which failed with an unrecognized error yet still exited 0. The author fixed it by pointing Claude Code's CLAUDE_CODE_SHELL setting and VS Code's Copilot terminal profile at Homebrew's bash 5, while leaving their own zsh terminal unchanged. The post is a personal account of a small bug and its fix in the author's dotfiles, not a general tutorial.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in