claude install adds ~/.local/bin to ~/.bashrc only — macOS login shells do not read it, so `claude` is missing from PATH in new terminals

Resolved 💬 1 comment Opened Jun 6, 2026 by gthneo Closed Jul 12, 2026

What happened

On macOS, after installing/updating Claude Code, opening a new terminal window cannot find claude (command not found). I have to manually run

echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc && source ~/.bashrc

every time — and it only fixes the current window, while also accumulating duplicate lines in ~/.bashrc on each repeat.

Root cause

claude install writes the ~/.local/bin PATH export into ~/.bashrc. That follows the Linux convention, where terminal emulators start non-login interactive shells that read .bashrc.

But on macOS, terminal apps (Terminal.app, WezTerm, iTerm2, …) start login shells, which read ~/.bash_profile / ~/.profile and do not read ~/.bashrc (and .bash_profile does not source .bashrc by default). So the PATH entry written to .bashrc is never loaded in new shells, and ~/.local/bin/claude stays off PATH.

zsh users are unaffected because interactive zsh reads .zshrc.

Proof (clean login vs non-login shell, inherited env stripped)

$ env -i HOME="$HOME" bash -lc 'case ":$PATH:" in *"/.local/bin:"*) echo YES;; *) echo NO;; esac'
NO        # login shell (what the terminal actually starts) — .local/bin missing
$ env -i HOME="$HOME" bash -ic 'case ":$PATH:" in *"/.local/bin:"*) echo YES;; *) echo NO;; esac'
YES       # non-login interactive shell reads .bashrc — works

(env -i is required; otherwise the inherited PATH masks the bug and gives a false positive.)

Environment

  • Claude Code: 2.1.167
  • macOS 26.3, arm64
  • Login shell: /bin/bash

Suggested fix

  1. On macOS with a bash login shell, write the PATH entry to ~/.bash_profile (or ~/.profile) — the file login shells actually read — or ensure ~/.bash_profile sources ~/.bashrc.
  2. Before appending, check whether the line already exists (e.g. grep -q) so repeated installs/updates don't pile up duplicate export PATH=... lines.

Workaround

Add to ~/.bash_profile:

[[ -f ~/.bashrc ]] && source ~/.bashrc

and make the .bashrc entry idempotent:

case ":$PATH:" in *":$HOME/.local/bin:"*) ;; *) export PATH="$HOME/.local/bin:$PATH" ;; esac

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗