Skip to content

Instantly share code, notes, and snippets.

@paulsheldrake
Last active August 6, 2025 22:00
Show Gist options
  • Save paulsheldrake/c53ba6f4c7659e3b12165ac635d7813a to your computer and use it in GitHub Desktop.
Save paulsheldrake/c53ba6f4c7659e3b12165ac635d7813a to your computer and use it in GitHub Desktop.
Install Claude code locally
#!/bin/bash
# Exit immediately if any command fails
set -e
echo "πŸ”§ Installing NVM..."
# Download and install NVM
export NVM_DIR="$HOME/.nvm"
if [ -d "$NVM_DIR" ]; then
echo "⚠️ NVM is already installed."
else
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
fi
# Load NVM (necessary in non-login scripts)
export NVM_DIR="$HOME/.nvm"
# shellcheck disable=SC1090
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
echo "βœ… NVM installed."
echo "πŸ“¦ Installing latest LTS version of Node.js..."
nvm install --lts
nvm use --lts
nvm alias default 'lts/*'
echo "βœ… Node.js LTS installed: $(node -v)"
echo "🌐 Installing 'claude-code' globally via npm..."
npm install -g @anthropic-ai/claude-code
echo "πŸŽ‰ All done! 'claude-code' installed globally."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment