[FEATURE] Installer should be able to install in a global folder like /usr/local/
Preflight Checklist
- [x] I have searched existing requests and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)
Problem Statement
When running Claude Code in a CI environment some users might need to preinstall the binary in their docker image. This creates a problem as the installation is often done as root during the setup and results in Claude Code to be installed under ~/.local/ which resolves into /root/.local/:
/root/.local/
|-- bin
| `-- claude -> /root/.local/share/claude/versions/2.0.58
|-- share
| `-- claude
| `-- versions
| `-- 2.0.58
`-- state
`-- claude
`-- locks
This creates problems as under docker it is recommended to run the under an unprivileged user:
USER runner
That user will not (or should not) have access to /root/.local/.
Copying the binary claude to /usr/local/bin/ is not enough as then claude has problems when trying to run an upgrade.
Proposed Solution
If the installer (and the claude binary) would have an option for installing in a different folder (ex: --prefix or INSTALL_DIR=) this could help CI setups.
Of course, we would still have a problem for a normal user to run claude update, but perhaps the binary could install under the current user's ~/.local/.
Alternative Solutions
_No response_
Priority
Medium - Would be very helpful
Feature Category
CLI commands and flags
Use Case Example
Example scenario:
- Dockerfile installs
claudeasrootunder/usr/local/in a multi-stage build namedbuilder - Final stage copies
claudefiles from the multi-stagebuild namedbuilderinto its own image - Dockerimage sets a unprivileged user a the current user (ex:
runner) - Docker image is built and published
- CI/CD runners pulls image and runs workflow
- CI workflow references
claudefrom/usr/local/bin/claudeand runs as userrunner - Workflow decides to update
claude - Update works (this is optional, I would understand if the update fails)
Additional Context
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗