Symptom
npm install -g for some command-line tool reports EACCES: permission denied. Or pip install reports error: externally-managed-environment and refuses to install.
Possible causes (most common first)
- npm's global directory sits under a system path that your account does not own, so an ordinary user cannot write to it.
- Python was installed by the system or a package manager and is marked as “externally managed”. Under the Python packaging specification, pip refuses to install into such an interpreter outside a virtual environment, so it does not break other software that depends on it.
- Packages were installed with elevated privileges in the past, leaving files in the cache directory that you do not own, and later installs as an ordinary user fail as a result.
Troubleshooting steps (easiest first)
npm: prefer a Node version manager
The official npm documentation lists this as the first choice: reinstall Node and npm with a version manager (nvm, fnm and similar). Node and the global packages then live in your home folder, which avoids the permission problem at its source and makes switching Node versions between projects easy. You do not need to uninstall the existing Node first.
npm: or change the global directory
If you would rather keep your current install, change npm's default directory as the same document describes: run
npm config set prefix ~/.localand add the linePATH=~/.local/bin:$PATHto~/.profile. With zsh, the macOS default, also add the linesource ~/.profileto~/.zprofile. Open a new terminal and install the global package again.Python: use a virtual environment
The approach given by the Python packaging specification is to install project dependencies into a virtual environment. In the project folder run
python3 -m venv .venv, thensource .venv/bin/activate. Everypip installafter that goes into this folder, and deleting the folder leaves nothing behind.Python: use pipx for command-line tools
If what you want is a globally available command-line program and not a library, use pipx. It creates a separate virtual environment for each program and puts the command on your PATH. pipx itself can be installed with Homebrew.
Do not force it with the override flag
The error message mentions the
--break-system-packagesflag. The specification itself positions it as a risky override, and the name is the warning. On a machine meant to run tasks for a long time, a damaged system Python takes a lot of time to track down. For the same reason, do not run npm or pip with elevated privileges just to get past the error.
When to contact support directly
These problems can almost always be solved inside your own home folder, so you normally do not need support. The exceptions: your home folder itself is not writable (for example ~/.npm or ~/.local is not owned by you and you cannot change it back with your own account), or the install fails because the disk is full. Contact support on Contact support with your machine ID, the full failing command and error text, and the output of ls -ld on the folder that fails.
FAQ
What if I get EACCES while installing Claude Code?
The approach is the same: do not install with elevated privileges. For Claude Code's install methods and troubleshooting steps, follow the install troubleshooting page in its official documentation.
Related
- Can I install Node, Homebrew and Docker on a rented Mac mini myself?
- Remote Mac mini for heavy Claude Code use: an always-on workstation, not account insurance
- Homebrew install fails with Permission denied on a rented Mac, or brew: command not found
- Claude Code: Operation not permitted when accessing the Desktop or Documents folder on Mac
- How much RAM do I need for local LLMs on a Mac? Rent a Mac mini for a month before buying
Pricing and availability: see the plans page · Help center (中文) · Refund policy (中文) · Telegram Contact support