[BUG] 'claude doctor' recommends adding non-existent directory to $PATH
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
I've installed Claude Code via MacPorts, which means the claude binary is installed as /opt/local/bin/claude on my system. (More generally MacPorts installs it as ${prefix}/bin/claude, because MacPorts allows using a custom installation prefix.)
Running claude doctor then shows this output:
❯ claude doctor
Diagnostics
└ Currently running: native (2.1.2)
└ Path: /opt/local/bin/claude
└ Invoked: /opt/local/bin/claude
└ Config install method: native
└ Auto-updates: disabled (DISABLE_AUTOUPDATER set)
└ Search: OK (bundled)
Warning: Native installation exists but ~/.local/bin is not in your PATH
Fix: Run: echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc then open a new terminal or run: source ~/.zshrc
Press Enter to continue…
The outputs recommends adding ~/.local/bin to the user's $PATH, but this directory doesn't exist and thus it doesn't make sense to recommend adding it.
In my case, /opt/local/bin is in my $PATH, so there is no need to add any directory for running this claude binary located at /opt/local/bin/claude.
By the way, I noticed that https://github.com/anthropics/claude-code/issues/10970#issuecomment-3489470983 shows output from claude doctor that shows Auto-updates: Managed by package manager. When does claude doctor consider Claude Code to be managed by a package manager? Because ideally that would also be what you see when Claude Code is installed via the MacPorts package manager. I'd be happy to make any changes to the port definition in MacPorts if necessary.
What Should Happen?
claude doctor should not recommend adding a non-existent directory to the user's $PATH.
I _do_ think it would be a good recommendation to tell the user to add the directory claude is in to the user's $PATH when the the directory that claude is in is not yet in the user's $PATH. It might be good to change the current implementation for this doctor check to this.
Error Messages/Logs
Steps to Reproduce
Run claude from any location which isn't ~/.local/bin/claude.
- It can be reproduced by putting the
claudebinary in any directory which isn't~/.local/binand runningclaude doctor. Example for macOS arm64:
❯ mkdir some-directory
❯ export PATH="$HOME/some-directory:$PATH"
❯ curl --output some-directory/claude https://storage.googleapis.com/claude-code-dist-86c565f3-f756-42ad-8dfa-d59b1c096819/claude-code-releases/2.1.2/darwin-arm64/claude
❯ chmod +x some-directory/claude
❯ claude doctor
Diagnostics
└ Currently running: native (2.1.2)
└ Path: /Users/breun/some-directory/claude
└ Invoked: /Users/breun/some-directory/claude
└ Config install method: native
└ Auto-updates: disabled (DISABLE_AUTOUPDATER set)
└ Search: OK (bundled)
Warning: Native installation exists but ~/.local/bin is not in your PATH
Fix: Run: echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc then open a new terminal or
run: source ~/.zshrc
Press Enter to continue…
When you have MacPorts installed, you can also reproduce it by installing the claude-code port and then running claude doctor:
❯ sudo port selfupdate
❯ sudo port install claude-code
❯ claude doctor
Diagnostics
└ Currently running: native (2.1.2)
└ Path: /opt/local/bin/claude
└ Invoked: /opt/local/bin/claude
└ Config install method: native
└ Auto-updates: disabled (DISABLE_AUTOUPDATER set)
└ Search: OK (bundled)
Warning: Native installation exists but ~/.local/bin is not in your PATH
Fix: Run: echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc then open a new terminal or run: source ~/.zshrc
Press Enter to continue…
In both cases claude doctor recommends adding a non-existent directory to the $PATH.
Claude Model
None
Is this a regression?
No
Last Working Version
_No response_
Claude Code Version
2.1.2 (Claude Code)
Platform
Google Vertex AI
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗