Last active
August 4, 2026 20:50
-
-
Save mateobur/97621e4c3be34cab714eb44db620028a to your computer and use it in GitHub Desktop.
No-root Claude Code install on locked-down macOS (Node LTS in ~/node + npm)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # No-root Claude Code install on locked-down macOS. | |
| # Node LTS (prebuilt) -> ~/node, then @anthropic-ai/claude-code via npm. | |
| # No root, no Xcode CLT, no git. Needs nodejs.org + registry.npmjs.org reachable. | |
| set -euo pipefail | |
| cd ~ | |
| A=$([ "$(uname -m)" = arm64 ] && echo arm64 || echo x64) | |
| echo ">> Detecting latest Node LTS for darwin-$A ..." | |
| ver=$(curl -fsSL https://nodejs.org/dist/index.json | tr '}' '\n' | grep '"lts":"' | head -1 | grep -oE 'v[0-9]+\.[0-9]+\.[0-9]+' | head -1) | |
| [ -n "$ver" ] || { echo "!! Could not resolve Node LTS version from nodejs.org (blocked?)."; exit 1; } | |
| file="node-$ver-darwin-$A.tar.gz" | |
| url="https://nodejs.org/dist/$ver/$file" | |
| echo ">> Node $ver — downloading $url" | |
| curl -fL -o ~/node.tar.gz "$url" | |
| tar -xzf ~/node.tar.gz -C ~ | |
| rm -rf ~/node && mv ~/"node-$ver-darwin-$A" ~/node | |
| rm -f ~/node.tar.gz | |
| export PATH="$HOME/node/bin:$PATH" | |
| grep -q 'HOME/node/bin' ~/.zshrc 2>/dev/null || echo 'export PATH="$HOME/node/bin:$PATH"' >> ~/.zshrc | |
| echo ">> Node $(node -v), npm $(npm -v)" | |
| echo ">> Installing @anthropic-ai/claude-code ..." | |
| npm install -g @anthropic-ai/claude-code | |
| grep -q DISABLE_AUTOUPDATER ~/.zshrc 2>/dev/null || echo 'export DISABLE_AUTOUPDATER=1' >> ~/.zshrc | |
| echo ">> DONE. Open a new terminal (or: source ~/.zshrc), then run: claude --version" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment