Urgent.News

What's breaking now, across thousands of outlets.

AI

Why Claude Code keeps writing shell commands that fail on your Mac

Disclaimer: AI helped me write this since I am not that good with words :) Claude wrote this, mid-task, while refactoring something unrelated: sed -i 's/old/new/' config.yml It's correct. It's the form you'll find in almost every StackOverflow answer, every blog post, every Dockerfile. It exited 0. And it left a file called config.yml-e sitting in my repo, because on macOS that command means…

Claude Code, an AI assistant, has been writing shell commands that fail on Mac systems. This issue occurs because the Bash tool used by Claude Code is not the default Bash on macOS, but rather the zsh shell. This mismatch between the expected and actual shell behavior leads to unexpected errors and incorrect command execution.

There are two primary reasons behind this issue. First, the Bash tool runs commands using the login shell, which is zsh on macOS since Catalina. This means that the command-line tools and options Claude Code uses may behave differently than expected. For example, the `rm -f` command behaves differently in zsh compared to bash, leading to non-zero exit codes and potential errors.

Second, Claude Code assumes GNU versions of standard tools, such as `sed` and `date`, while macOS ships with BSD versions. This discrepancy causes issues when executing commands like `sed -i s/a/b/ file`, as GNU sed is expected but BSD sed behaves differently. In the case of `sed -i`, the tool creates a backup file with a different suffix and performs the substitution, which is not the intended behavior on macOS.

To resolve these issues, two solutions have been documented. First, the `CLAUDE_CODE_SHELL` environment variable can be set to `bash` in the Claude Code settings.json file. This ensures that Claude Code uses the default Homebrew Bash installation instead of the zsh login shell. Additionally, the `CLAUDE_ENV_FILE` environment variable can be used to append shell statements, such as modifying the PATH to include GNU versions of tools like `coreutils`, `findutils`, `gnu-sed`, `gnu-awk`, `gnu-tar`, `gnu-which`, and `grep`. This allows Claude Code to use the correct GNU tools while still operating within the zsh shell.

By implementing these fixes, users can avoid the frequent failures and confusion caused by Claude Code's shell commands on Mac systems, ensuring a smoother and more reliable coding experience.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Also reported by 1 other outlet

Read the original at dev.to →

More in AI

I analyzed 3 weeks of my own messages to coding agents. 40% of what I typed was not real work. Is it the same for you?

I run several coding agents in parallel, mostly Claude Code and Kimi, sometimes Cursor and Copilot. I felt slow, so I exported every message I sent them over 3 weeks and had each one read and labeled…

  • 40% of user messages were categorized as overhead tasks
  • Common corrections related to UI work and agent behavior
  • Half of messages were scripts and test harnesses

Is the AI industry really ready to slow down?

On Equity, we debated whether Ai executives are serious about wanting to slow down.

  • Anthropic's Dario Amodei proposes AI development pacing plan
  • Nvidia CEO Jensen Huang dismisses AI backlash concerns as hoax
  • AI safety advocates emphasize need for third-party evaluators and international coordination

Your AI Knows How to Answer. But Who Teaches It What a Good Answer Is?

Hello, I'm Rijul, and I'm building LiveReview — a blast-radius aware AI code review built for your business-critical systems.

  • LiveReview aims to prevent blast-radius issues in business-critical systems with AI code review tool
  • RLHF uses separate reward model trained on human preferences before optimizing language model

A model doesn't read text: what a tokenizer decides for you

Originally published at cchinchilla.dev . Part 1 of From code to weights, a 12-part series on ML fundamentals for engineers. A language model has never seen a letter. It sees integers.

  • Tokenizer converts text into list of ids
  • Determined during model's training phase
  • Cannot be altered after model training

JEV assisted LLM Trading

We gave our LLM trading bot an auditor that never sees the chart Every hour, on the hour, a vision model looks at three forex charts and decides whether our bot should buy, sell, or sit out.

  • Geminisnapflash is a Python trading bot making hourly forex decisions.
  • JEV, a System-One model, grades the bot's directional calls for consistency.
  • JEV's verdict is recorded and compared with the bot's actual trade direction.

More from Sunday 20 September →