11#! /bin/bash
22# Claude Code configuration script
33# Primary purpose: Configure Claude Code CLI with MCP servers and settings
4- # Secondary purpose: Install Claude Code if not present (trivial npm install)
4+ # Secondary purpose: Install Claude Code if not present (one-line curl install)
55#
66# Configuration is the interesting problem - installation is a solved problem
77
@@ -54,17 +54,6 @@ configure_claude_code() {
5454# Installation is a one-time solved problem, configuration is ongoing
5555# ============================================================================
5656install_claude_if_needed () {
57- # Check prerequisites
58- if ! command -v node & > /dev/null; then
59- echo -e " ${RED} Node.js is not installed. Please install Node.js first.${NC} "
60- return 1
61- fi
62-
63- if ! command -v npm & > /dev/null; then
64- echo -e " ${RED} npm is not installed. Please install npm first.${NC} "
65- return 1
66- fi
67-
6857 # Check if Claude Code is already installed
6958 # Use type -P to ignore aliases and confirm the actual binary exists
7059 if type -P claude & > /dev/null; then
@@ -74,10 +63,15 @@ install_claude_if_needed() {
7463 return 0
7564 fi
7665
77- # Perform the trivial installation
78- echo " Installing Claude Code CLI (one-time setup)..."
79- if ! npm install -g @anthropic-ai/claude-code; then
80- echo -e " ${RED} Failed to install Claude Code CLI. Please try again or check your npm installation.${NC} "
66+ # Perform the one-line curl installation
67+ if ! command -v curl & > /dev/null; then
68+ echo -e " ${RED} curl is not installed. Please install curl first.${NC} "
69+ return 1
70+ fi
71+
72+ echo " Installing Claude Code CLI via official install script..."
73+ if ! curl -fsSL https://claude.ai/install.sh | bash; then
74+ echo -e " ${RED} Failed to install Claude Code CLI. Please try again or check your network connectivity.${NC} "
8175 return 1
8276 fi
8377 hash -r # ensure the shell picks up the newly installed binary
0 commit comments