#!/usr/bin/env sh # cc (copy claude) installer — https://cc.softwaresoftware.dev # curl -fsSL https://cc.softwaresoftware.dev/install.sh | sh set -eu BASE_URL="${CC_BASE_URL:-https://cc.softwaresoftware.dev}" BIN_DIR="${CC_BIN_DIR:-$HOME/.local/bin}" say() { printf '%s\n' "$*" >&2; } if ! command -v python3 >/dev/null 2>&1; then say "cc: python3 is required (3.8+). Install it and re-run." exit 1 fi mkdir -p "$BIN_DIR" tmp="$(mktemp)" if command -v curl >/dev/null 2>&1; then curl -fsSL "$BASE_URL/cc" -o "$tmp" elif command -v wget >/dev/null 2>&1; then wget -qO "$tmp" "$BASE_URL/cc" else say "cc: need curl or wget"; exit 1 fi head -c 200 "$tmp" | grep -q "copy claude" || { say "cc: download looked wrong, aborting"; rm -f "$tmp"; exit 1; } install -m 0755 "$tmp" "$BIN_DIR/cc" cp "$BIN_DIR/cc" "$BIN_DIR/claude-copy" rm -f "$tmp" say "cc: installed to $BIN_DIR/cc (also available as claude-copy)" # Warn about a shadowed C compiler (cc passes unknown args through to it, so builds keep working) other="" IFS_SAVE=$IFS; IFS=: for d in $PATH; do [ -z "$d" ] && continue [ "$d" = "$BIN_DIR" ] && continue if [ -x "$d/cc" ] && ! head -c 200 "$d/cc" 2>/dev/null | grep -q "copy claude"; then other="$d/cc"; break; fi done IFS=$IFS_SAVE if [ -n "$other" ]; then say "cc: note: $other (probably your C compiler) will be shadowed once $BIN_DIR is first on PATH." say " Anything cc doesn't recognize is passed straight through to it, so 'cc foo.c -o foo' still compiles." fi case ":$PATH:" in *":$BIN_DIR:"*) ;; *) say "cc: $BIN_DIR is not on your PATH. Add this to your shell rc:" say " export PATH=\"$BIN_DIR:\$PATH\"" ;; esac # Clipboard tool hint (Linux) if [ "$(uname -s)" = "Linux" ] && ! command -v wl-copy >/dev/null 2>&1 && ! command -v xclip >/dev/null 2>&1 \ && ! command -v xsel >/dev/null 2>&1 && ! command -v termux-clipboard-set >/dev/null 2>&1 \ && ! grep -qi microsoft /proc/version 2>/dev/null; then say "cc: tip: install wl-clipboard (Wayland) or xclip (X11) for clipboard support; KDE klipper and OSC52 are used as fallbacks." fi say "cc: done. Try: cc --help"