Skip to content

Commit d31fe98

Browse files
Merge branch 'master' into dependabot/npm_and_yarn/gatsby-5.16.1
2 parents 95b226b + cc20157 commit d31fe98

File tree

1 file changed

+35
-34
lines changed
  • src/collections/blog/2026/03-09-why-claude-code-cant-find-your-tools

1 file changed

+35
-34
lines changed

src/collections/blog/2026/03-09-why-claude-code-cant-find-your-tools/index.mdx

Lines changed: 35 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ featured: false
1616
published: true
1717
resource: true
1818
---
19+
1920
import { BlogWrapper } from "../../Blog.style.js";
2021
import { Link } from "gatsby";
2122
import Blockquote from "../../../../reusecore/Blockquote";
@@ -111,30 +112,30 @@ import KanvasCTA from "../../../../sections/Kanvas/kanvas-cta";
111112
You can observe this yourself. Run these two commands and compare the output:
112113
</p>
113114

114-
<pre>
115-
<code>{`# What a non-interactive shell sees
115+
```bash
116+
# What a non-interactive shell sees
116117
zsh -c 'echo $PATH'
117118

118119
# What your interactive shell sees
119-
echo $PATH`}</code>
120-
</pre>
120+
echo $PATH
121+
```
121122

122123
<p>
123124
On a typical macOS developer machine, the non-interactive shell might produce something like:
124125
</p>
125126

126-
<pre>
127-
<code>{`/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin`}</code>
128-
</pre>
127+
```text
128+
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
129+
```
129130

130131
<p>
131132
While your interactive shell shows something far richer:
132133
</p>
133134

134-
<pre>
135-
<code>{`/opt/homebrew/bin:/opt/homebrew/sbin:/Users/you/.nvm/versions/node/v20.11.0/bin:
136-
/Users/you/go/bin:/Users/you/.local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin`}</code>
137-
</pre>
135+
```text
136+
/opt/homebrew/bin:/opt/homebrew/sbin:/Users/you/.nvm/versions/node/v20.11.0/bin:
137+
/Users/you/go/bin:/Users/you/.local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
138+
```
138139

139140
<p>
140141
All those extra paths — Homebrew, nvm, Go binaries — live in <code>{"~/.zshrc"}</code>, <code>{"~/.zprofile"}</code>, or in scripts those files source. A non-interactive shell never reads any of them.
@@ -146,17 +147,17 @@ echo $PATH`}</code>
146147
Before changing anything, confirm the symptom. Use <code>zsh -c</code> to simulate what Claude Code sees:
147148
</p>
148149

149-
<pre>
150-
<code>{`# Does Claude Code's shell see the tool?
150+
```bash
151+
# Does Claude Code's shell see the tool?
151152
zsh -c 'which gh'
152153
zsh -c 'which go'
153154
zsh -c 'which node'
154155

155156
# Does your interactive shell see it?
156157
zsh -i -c 'which gh'
157158
zsh -i -c 'which go'
158-
zsh -i -c 'which node'`}</code>
159-
</pre>
159+
zsh -i -c 'which node'
160+
```
160161

161162
<p>
162163
The <code>-i</code> flag forces an interactive shell, which sources <code>{"~/.zshrc"}</code>. If <code>zsh -c 'which gh'</code> prints <code>gh not found</code> but <code>zsh -i -c 'which gh'</code> prints the correct path, your PATH export is in <code>{"~/.zshrc"}</code> and you have confirmed the root cause.
@@ -178,8 +179,8 @@ zsh -i -c 'which node'`}</code>
178179
Open (or create) <code>{"~/.zshenv"}</code> and add your PATH exports there:
179180
</p>
180181

181-
<pre>
182-
<code>{`# ~/.zshenv
182+
```bash
183+
# ~/.zshenv
183184
# Sourced for every zsh invocation — interactive, login, and non-interactive alike
184185

185186
# Homebrew (Apple Silicon)
@@ -190,23 +191,23 @@ export GOPATH="$HOME/go"
190191
export PATH="$GOPATH/bin:$PATH"
191192

192193
# Local binaries
193-
export PATH="$HOME/.local/bin:$PATH"`}</code>
194-
</pre>
194+
export PATH="$HOME/.local/bin:$PATH"
195+
```
195196

196197
<p>
197198
For tools that inject themselves via an eval expression in <code>{"~/.zshrc"}</code> — such as <code>nvm</code>, <code>pyenv</code>, or <code>rbenv</code> — you need to move or duplicate that initialization into <code>{"~/.zshenv"}</code> as well:
198199
</p>
199200

200-
<pre>
201-
<code>{`# ~/.zshenv — nvm initialization for non-interactive shells
201+
```bash
202+
# ~/.zshenv — nvm initialization for non-interactive shells
202203
export NVM_DIR="$HOME/.nvm"
203204
[ -s "$NVM_DIR/nvm.sh" ] && source "$NVM_DIR/nvm.sh" --no-use
204205

205206
# pyenv
206207
export PYENV_ROOT="$HOME/.pyenv"
207208
export PATH="$PYENV_ROOT/bin:$PATH"
208-
eval "$(pyenv init --path)"`}</code>
209-
</pre>
209+
eval "$(pyenv init --path)"
210+
```
210211

211212
<p>
212213
Note the <code>--no-use</code> flag for nvm: it initializes nvm without switching to the default Node.js version, which speeds up shell startup for non-interactive contexts. Remove it if you want the default version active everywhere.
@@ -216,15 +217,15 @@ eval "$(pyenv init --path)"`}</code>
216217
After saving <code>{"~/.zshenv"}</code>, verify without restarting your terminal:
217218
</p>
218219

219-
<pre>
220-
<code>{`# Reload .zshenv in your current shell
220+
```bash
221+
# Reload .zshenv in your current shell
221222
source ~/.zshenv
222223

223224
# Confirm Claude Code's shell type now finds the tool
224225
zsh -c 'which gh'
225226
zsh -c 'which go'
226-
zsh -c 'which node'`}</code>
227-
</pre>
227+
zsh -c 'which node'
228+
```
228229

229230
<h2>What to Keep in <code>{"~/.zshrc"}</code> vs <code>{"~/.zshenv"}</code></h2>
230231

@@ -288,8 +289,8 @@ zsh -c 'which node'`}</code>
288289
Here is a starting point for a <code>{"~/.zshenv"}</code> that covers the most common developer tools on macOS. Adjust paths to match your actual installations:
289290
</p>
290291

291-
<pre>
292-
<code>{`# ~/.zshenv
292+
```bash
293+
# ~/.zshenv
293294
# Sourced for ALL zsh shells — interactive, login, and non-interactive.
294295
# Keep this file fast and free of output-producing commands.
295296

@@ -322,16 +323,16 @@ fi
322323
# Editor and locale
323324
export EDITOR="vim"
324325
export LANG="en_US.UTF-8"
325-
export LC_ALL="en_US.UTF-8"`}</code>
326-
</pre>
326+
export LC_ALL="en_US.UTF-8"
327+
```
327328

328329
<p>
329330
With this in place, restart Claude Code (or any tool that spawns subshells) and run your verification:
330331
</p>
331332

332-
<pre>
333-
<code>{`zsh -c 'which gh && which go && which node'`}</code>
334-
</pre>
333+
```bash
334+
zsh -c 'which gh && which go && which node'
335+
```
335336

336337
<p>
337338
All three should now resolve to their correct paths.

0 commit comments

Comments
 (0)