Auto-update permission check tests wrong directory

Resolved 💬 3 comments Opened Mar 4, 2026 by GiumaSoft Closed Mar 8, 2026

Bug Description

The auto-update permission check in /status reports No write permissions for auto-updates (requires sudo) even when the user has full write access to the actual installation directory.

Root Cause

In cli.js, the function qBY retrieves the npm global prefix via npm -g config get prefix, which returns /usr/local. Then jI8 checks write permissions on that prefix directory using accessSync(prefix, W_OK).

However, /usr/local is typically owned by root:wheel on macOS, while the actual npm packages live in /usr/local/lib/node_modules/ which can be owned by the user (e.g. via Homebrew).

The check should test write permissions on the actual installation path (e.g. /usr/local/lib/node_modules/) rather than the npm prefix root (/usr/local).

Steps to Reproduce

  1. Have npm installed via Homebrew on macOS (common setup)
  2. /usr/local is owned by root:wheel (default macOS)
  3. /usr/local/lib/node_modules/ is owned by your user (Homebrew default)
  4. Run /status in Claude Code
  5. Observe: ⚠ No write permissions for auto-updates (requires sudo)

Expected Behavior

The permission check should pass, since the user can write to /usr/local/lib/node_modules/@anthropic-ai/claude-code/.

Actual Behavior

The check fails because it tests /usr/local instead of the actual package directory.

Environment

  • macOS (Darwin 25.3.0)
  • Claude Code 2.1.68
  • npm prefix: /usr/local (owned by root:wheel, drwxr-xr-x)
  • Package dir: /usr/local/lib/node_modules/ (owned by user, writable)

Suggested Fix

In jI8, instead of:

accessSync(npmPrefix, W_OK)

Use something like:

accessSync(path.join(npmPrefix, 'lib', 'node_modules'), W_OK)

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗