Skip to content

Instantly share code, notes, and snippets.

@robertsinfosec
Last active October 29, 2025 06:07
Show Gist options
  • Select an option

  • Save robertsinfosec/6eae0ed189b0343f8e139830d56a42a9 to your computer and use it in GitHub Desktop.

Select an option

Save robertsinfosec/6eae0ed189b0343f8e139830d56a42a9 to your computer and use it in GitHub Desktop.
Add LLM CLI's via bash. This first installs the Node Version Manager (NVM), then installs the latest NodeJS. Then, this installs: Google Gemini CLI, Anthropic Claude CLI, GitHub Copilot CLI, OpenCode (for running against Ollama), and OpenAI's Codex CLI.
#!/usr/bin/env bash
set -euo pipefail
# --- prereqs ---
sudo apt-get update -y
sudo apt-get install -y --no-install-recommends ca-certificates curl git build-essential unzip
mkdir -p "$HOME/.local/bin"
grep -q 'export PATH="$HOME/.local/bin:$PATH"' "$HOME/.bashrc" \
|| echo 'export PATH="$HOME/.local/bin:$PATH"' >> "$HOME/.bashrc"
# --- nvm + Node LTS (pin v0.40.3) ---
export NVM_DIR="$HOME/.nvm"
NVM_VERSION="v0.40.3"
if ! command -v nvm >/dev/null 2>&1; then
mkdir -p "$NVM_DIR"
curl -fsSL "https://raw.githubusercontent.com/nvm-sh/nvm/${NVM_VERSION}/install.sh" | bash
fi
# ensure shell init (bash + zsh) exactly once
for rc in "$HOME/.bashrc" "$HOME/.zshrc"; do
[ -f "$rc" ] || continue
grep -q 'export NVM_DIR="$HOME/.nvm"' "$rc" || cat >> "$rc" <<'EOF'
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
EOF
done
# load nvm now (current shell)
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
# latest LTS Node and make it default (safe to re-run)
nvm install --lts
nvm alias default 'lts/*'
nvm use default
echo "node: $(node -v) | npm: $(npm -v)"
# --- CLIs (safe to re-run) ---
npm install -g @google/gemini-cli@latest
npm install -g @anthropic-ai/claude-code@latest
npm install -g @github/copilot@latest
npm install -g opencode-ai@latest
npm install -g @openai/codex@latest # ← NEW: OpenAI Codex CLI
# --- quick checks (non-fatal) ---
gemini --version || true
claude --version || true
copilot --version || true
opencode --version || true
codex --version || true
echo "✅ Done. Open a new shell or 'source ~/.bashrc' (or ~/.zshrc)."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment