[BUG] claude doctor reports insufficient permissions for automatic updates when using NVM
Status Fixed / completed
Maintainer reply None cached
Workaround ✓ Mentioned in thread ↓
Activity 12 comments · opened Mar 12, 2025 · closed Aug 6, 2025
Environment
- Platform (select one):
- [x] Anthropic API
- [ ] AWS Bedrock
- [ ] Google Vertex AI
- [ ] Other: <!-- specify -->
- Claude CLI version: 0.2.37
- Operating System: macOS 15.3.1
- Terminal: iTerm2
Bug Description
I use NVM on mac. NVM sets up my global prefix as a directory that my user owns, under my home DIR:
$ npm prefix -g
/Users/bburns/.nvm/versions/node/v22.13.1
$ ls -al $(npm prefix -g)
total 1248
drwxr-xr-x@ 9 bburns staff 288 Jan 29 17:41 .
drwxr-xr-x@ 7 bburns staff 224 Feb 21 13:04 ..
-rw-r--r--@ 1 bburns staff 454231 Jan 21 14:38 CHANGELOG.md
-rw-r--r--@ 1 bburns staff 140397 Jan 21 14:38 LICENSE
-rw-r--r--@ 1 bburns staff 39769 Jan 21 14:38 README.md
drwxr-xr-x@ 18 bburns staff 576 Mar 12 18:51 bin
drwxr-xr-x@ 3 bburns staff 96 Jan 21 14:38 include
drwxr-xr-x@ 3 bburns staff 96 Jan 21 14:38 lib
drwxr-xr-x@ 4 bburns staff 128 Jan 21 14:38 share
This is a standard NVM setup on mac, designed to avoid the user having to use sudo when doing global installs.
In spite of this, running claude doctor reports Claude Code can't update itself because it doesn't have sufficient permissions.
Steps to Reproduce
- Set up node using NVM
- Run
npm install -g @anthropic-ai/claude-code - Run
claude doctor
Expected Behavior
It wouldn't complain about update permissions.
Actual Behavior
It complains about update permissions.
Additional Context
<img width="1728" alt="Image" src="https://github.com/user-attachments/assets/5b19aed9-f522-4adb-a58a-33d432da19c1" />
12 Comments
I've been able to reproduce this same symptom on Ubuntu 24.04.
I've followed your instructions exactly for a local npm prefix.
It shouldn't matter, but I've tried with apt-installed
nodejs,nvm-installednode, andfvm-installednode, and tried with node v20.19.0 and v22.14.0, usingnpmv11.2.0.One suggestion:
claude --debug doctoremits no debug logging. You might want to emit what directory and what mode bits you think aren't correct, just to help your own engineers track down this issue.reproduced on mac 15.3.1 (24D70) with:
❯ nvm --version
0.40.1
❯ node --version
v20.14.0
I tried setting the entire .nvm dir and subdirs to be user writeable and reinstalling but that did nothing. Hmm
Happens to me as well on macOS 15.3.2.
Following Anthropic's own recommended solution does not fix it.
Same! I have tried sudo but that wasn't the right idea to go with.
Claude warning: "✗ Auto-update failed · Try claude doctor or npm i -g @anthropic-ai/claude-code"
Reproduced on Mac OS 15.5 (24F74)
❯ nvm --version
0.39.7
❯ node --version
v23.10.0
❯ claude --version
1.0.39 (Claude Code)
Not sure if I should close this, as others are still apparently experiencing this issue, but I no longer experience this problem.
Unfortunately I don't have the same laptop where this was originally happening to test, but I do still run claude code on a mac that uses an essentially identical setup (NVM, same dotfiles, etc). I just found that
claude doctorno longer gives me this error. This was on v1.0.35 installed into my current NVM default node version's global NPM prefix.<img width="629" alt="Image" src="https://github.com/user-attachments/assets/514878fb-57dc-4566-b30b-e8fe2010b815" />
As you can see in the above screenshot, it also advised me to run
/migrate-installerin a normal claude session to migrate my claude installation to~/.claude/localand enable automatic updates. That sort of install is preferable to me, so I did that. In the process it updated to v1.0.41, andclaude doctorseems happy now. 👇<img width="649" alt="Image" src="https://github.com/user-attachments/assets/0c3b4f24-03c5-4be0-adc3-6be55238547b" />
Note that you'll need to run
source ~/.zprofileor close/reopen your terminal session to get theclaudecommand to work after the installer migration. Unfortunately it doesn't (can't?) add theclaudealias that it creates to your current terminal session automatically.I'll leave this open for now, but if others report a similar sequence of events fixes this for them, and nobody seems to be reporting that they're still having this issue, I'm happy to close.
@benjamincburns thank you that worked. Small correction to your final step tho.
After all the steps refresh terminal:
source ~/.zshrcKey steps.
source ~/.zshrcor your appropriate terminal reload (bash, etc)claude config set -g autoUpdates trueI still have this issue (not a dev so forgive me if I miss something obvious).
Used ChatGPT to help diagnose the problem. Turns out on my Mac there is nothing wrong with the file/folder permissions per se, but the update (from within claude itself) still fails.
Was on version CC 1.0.64.
MAC 15.5 M4 Air
npm 11.5.2
node 24.4.1
--
Running this manually worked:
npm update -g @anthropic-ai/claude-code --loglevel verbose
However the issue of doing this via CC persists:
% claude update
Current version: 1.0.65
Checking for updates...
Warning: Insufficient permissions for auto-updates
Fix: Run: sudo chown -R $USER:$(id -gn) $(npm -g config get prefix)or use
claude migrate-installerto migrate to local installationClaude Code is up to date (1.0.65)
--
I assume running it via sudo would work as would moving it locally but didn't try.
In order to fix missing privileges of a global installation, claude doctor asked me to run the following command, which could result in severe system damage:
sudo chown -R $(id -gn) $(npm -g config get prefix)
Because npm -g config get prefix resolves to /usr, this command recursively changes ownership of the entire /usr directory to the user's primary group. This breaks critical system functionality and renderes sudo, pkexec, and other tools unusable.
System:
OS: Ubuntu 22.04 LTS
Node.js: v20.19.4
npm: 10.8.2
npm prefix: /usr
@rdrcode I think you should open a new issue for that, as it's distinctly different from the one I describe in my original post above. Your issue looks to be similar to the issue that @TheITVeteran is having.
Given that I'm not seeing any new reports of the same issue that I had originally, I'm going to close this so I stop getting notifications about unrelated things.
This is still an issue, but for anyone encountering this - you can install native and it should resolve it. Using the built-in command to migrate to the native installation _will silently fail_ if you attempt it (specifically speaking, Claude uninstalls itself and leaves it at that), so just uninstall it globally and reinstall it natively.
@anthropic-ai/claude-codeclaude doctorto check the output.Full Run-Through
_In a new terminal..._
If you have Bun installed, here is a detailed analysis and a workaround that resolved the issue for me: https://github.com/anthropics/claude-code/issues/3980#issuecomment-3092423248
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.