#!/usr/bin/env bash # # install.sh — one-shot installer for cmux + Claude Code on macOS # # curl -fsSL https://YOUR-DOMAIN/install.sh | bash # # Installs (only what's missing): # • Xcode Command Line Tools (needed by Homebrew) # • Homebrew (package manager) # • cmux (macOS terminal for AI coding agents) # • Claude Code (the `claude` CLI) # set -euo pipefail # ---- pretty output ------------------------------------------------------- BOLD=$'\033[1m'; GREEN=$'\033[32m'; YELLOW=$'\033[33m'; RED=$'\033[31m'; RESET=$'\033[0m' say() { printf "%s\n" "${BOLD}==>${RESET} $*"; } ok() { printf "%s\n" "${GREEN}OK${RESET} $*"; } warn() { printf "%s\n" "${YELLOW}!${RESET} $*"; } die() { printf "%s\n" "${RED}x $*${RESET}" >&2; exit 1; } # ---- preflight ----------------------------------------------------------- [ "$(uname -s)" = "Darwin" ] || die "This installer is for macOS. On Windows use install.ps1." macos_ver="$(sw_vers -productVersion)" macos_major="${macos_ver%%.*}" if ! { [ "$macos_major" -ge 14 ] 2>/dev/null; }; then warn "cmux needs macOS 14 or later — you have $macos_ver. cmux may fail to install (Claude Code will still work)." fi # ---- Xcode Command Line Tools (Homebrew depends on these) ---------------- if ! xcode-select -p >/dev/null 2>&1; then say "Installing Xcode Command Line Tools (a system dialog may appear)…" xcode-select --install >/dev/null 2>&1 || true printf " waiting for Command Line Tools to finish installing" until xcode-select -p >/dev/null 2>&1; do printf "."; sleep 5; done printf "\n" ok "Command Line Tools ready" else ok "Command Line Tools already present" fi # ---- Homebrew ------------------------------------------------------------ if ! command -v brew >/dev/null 2>&1; then say "Installing Homebrew…" NONINTERACTIVE=1 /bin/bash -c \ "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" fi # Load brew into this shell session (Apple Silicon vs Intel paths) if [ -x /opt/homebrew/bin/brew ]; then eval "$(/opt/homebrew/bin/brew shellenv)" elif [ -x /usr/local/bin/brew ]; then eval "$(/usr/local/bin/brew shellenv)"; fi command -v brew >/dev/null 2>&1 || die "Homebrew installation failed." ok "Homebrew ready" # ---- cmux ---------------------------------------------------------------- if [ -d "/Applications/cmux.app" ]; then ok "cmux already installed" else say "Installing cmux…" brew tap manaflow-ai/cmux brew install --cask cmux ok "cmux installed" fi # ---- Claude Code --------------------------------------------------------- if command -v claude >/dev/null 2>&1; then ok "Claude Code already installed" else say "Installing Claude Code…" curl -fsSL https://claude.ai/install.sh | bash fi # The native installer drops `claude` in ~/.local/bin export PATH="$HOME/.local/bin:$PATH" # ---- verify -------------------------------------------------------------- say "Verifying installation…" if claude --version >/dev/null 2>&1; then ok "Claude Code: $(claude --version 2>/dev/null)" else warn "Claude Code installed but not yet on PATH — restart your terminal, then run: claude" fi if [ -d /Applications/cmux.app ]; then ok "cmux: /Applications/cmux.app" else warn "cmux was not found in /Applications." fi # ---- launch + next steps ------------------------------------------------- cat </dev/null || true