Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 26 additions & 2 deletions INSTALL_ES.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
# Guía de Instalación en macOS
# Copilot for Xcode <img alt="Logo" src="/AppIcon.png" align="right" height="50">

**Copilot for Xcode** es el proyecto de GitHub que permite usar **GitHub Copilot como agente dentro de Xcode**. Es una extensión del editor de código fuente de Xcode que integra GitHub Copilot, Codeium y ChatGPT directamente en tu entorno de desarrollo.

- 🔗 Proyecto en GitHub: [https://github.com/intitni/CopilotForXcode](https://github.com/intitni/CopilotForXcode)

## Guía de Instalación en macOS

[English installation instructions / Instrucciones de instalación en inglés](README.md#installation-and-setup)

Expand Down Expand Up @@ -27,7 +33,25 @@ Para funciones de chat y "Prompt to Code":

> Si te preocupa el registro de teclas y no puedes confiar en el binario, recomendamos revisar el código y [compilarlo tú mismo](DEVELOPMENT.md).

## Instalación y Configuración
## Instalación Automática

Para instalar automáticamente con un solo comando, ejecuta esto en la **Terminal**:

```bash
bash <(curl -fsSL https://raw.githubusercontent.com/intitni/CopilotForXcode/main/install.sh)
```

El script comprobará los requisitos previos, instalará la app mediante Homebrew (si está disponible) y te guiará paso a paso por las acciones manuales necesarias.

Si ya tienes el repositorio clonado localmente, también puedes ejecutar:

```bash
bash install.sh
```

---

## Instalación y Configuración Manual

> El proceso de instalación puede parecer complejo al principio. Aquí tienes un resumen rápido:
>
Expand Down
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,17 @@ For chat and prompt to code features:
> 4. Setup accounts and models in the host app.
> 5. Optionally, update the settings of each feature in the host app, and setup keybindings.

### Install
### Automated Install

Run the following command in Terminal to install automatically:

```bash
bash <(curl -fsSL https://raw.githubusercontent.com/intitni/CopilotForXcode/main/install.sh)
```

The script checks prerequisites, installs the app via Homebrew (if available), and guides you through the required manual steps.

### Manual Install

You can install it via [Homebrew](http://brew.sh/):

Expand Down
136 changes: 136 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
#!/usr/bin/env bash
# install.sh — Automated installer for Copilot for Xcode
# https://github.com/intitni/CopilotForXcode
#
# Usage:
# curl -fsSL https://raw.githubusercontent.com/intitni/CopilotForXcode/main/install.sh | bash
# or, if you have already cloned the repo:
# bash install.sh

set -euo pipefail

# ── Constants ─────────────────────────────────────────────────────────────────
MIN_MACOS_MAJOR=13

# ── Colour helpers ────────────────────────────────────────────────────────────
RED='\033[0;31m'; GREEN='\033[0;32m'; YELLOW='\033[1;33m'
CYAN='\033[0;36m'; BOLD='\033[1m'; NC='\033[0m'

info() { echo -e "${CYAN}[INFO]${NC} $*"; }
success() { echo -e "${GREEN}[OK]${NC} $*"; }
warn() { echo -e "${YELLOW}[WARN]${NC} $*"; }
error() { echo -e "${RED}[ERROR]${NC} $*" >&2; }
step() { echo -e "\n${BOLD}▶ $*${NC}"; }
manual() { echo -e "${YELLOW} ➤ MANUAL STEP REQUIRED:${NC} $*"; }

# ── Step 0: Platform check ────────────────────────────────────────────────────
step "Checking platform"

if [[ "$(uname)" != "Darwin" ]]; then
error "Copilot for Xcode requires macOS. This system is $(uname)."
exit 1
fi

MACOS_VERSION=$(sw_vers -productVersion)
MACOS_MAJOR=$(echo "$MACOS_VERSION" | cut -d. -f1)
MACOS_MINOR=$(echo "$MACOS_VERSION" | cut -d. -f2)

if [[ "$MACOS_MAJOR" -lt $MIN_MACOS_MAJOR ]]; then
error "macOS $MIN_MACOS_MAJOR (Ventura) or later is required. Found: $MACOS_VERSION"
exit 1
fi

success "macOS $MACOS_VERSION detected (requirement: $MIN_MACOS_MAJOR+)"

# ── Step 1: Install via Homebrew (preferred) ──────────────────────────────────
step "Installing Copilot for Xcode"

if command -v brew &>/dev/null; then
info "Homebrew found. Installing via 'brew install --cask copilot-for-xcode' ..."
if brew install --cask copilot-for-xcode; then
success "Copilot for Xcode installed via Homebrew."
else
error "Homebrew installation failed."
echo
echo " Fallback — Download manually:"
echo " https://github.com/intitni/CopilotForXcode/releases/latest"
echo " Then move 'Copilot for Xcode.app' into /Applications."
echo
read -rp " Press ENTER once the app is in /Applications to continue ..."
fi
else
warn "Homebrew is not installed."
echo
echo " Option A — Install Homebrew first, then re-run this script:"
echo " /bin/bash -c \"\$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)\""
echo
echo " Option B — Download manually:"
echo " https://github.com/intitni/CopilotForXcode/releases/latest"
echo " Then move 'Copilot for Xcode.app' into /Applications."
echo
read -rp " Press ENTER once the app is in /Applications to continue ..."
fi

# ── Step 2: Verify the app exists and open it ─────────────────────────────────
step "Opening Copilot for Xcode"

APP_PATH="/Applications/Copilot for Xcode.app"

if [[ ! -d "$APP_PATH" ]]; then
error "Could not find '$APP_PATH'. Make sure the app is in the Applications folder."
exit 1
fi

open "$APP_PATH"
success "Copilot for Xcode launched. It will register its background service automatically."

# ── Step 3: Node.js check ─────────────────────────────────────────────────────
step "Checking Node.js (required for GitHub Copilot suggestions)"

if command -v node &>/dev/null; then
NODE_VERSION=$(node --version)
success "Node.js $NODE_VERSION found at $(command -v node)"
else
warn "Node.js was not found in PATH."
echo
echo " Node.js is required to use GitHub Copilot suggestions."
echo " Install it from https://nodejs.org/ or via Homebrew:"
echo " brew install node"
fi

# ── Step 4: Manual steps summary ─────────────────────────────────────────────
step "Manual steps required after installation"

MACOS_DISPLAY="macOS $MACOS_MAJOR.$MACOS_MINOR"

echo
echo " The following steps cannot be automated and must be done manually:"
echo

echo " 1. Enable the Xcode Source Editor Extension in System Settings:"
if [[ "$MACOS_MAJOR" -ge 15 ]]; then
manual "System Settings → General → Login Items & Extensions → Xcode Source Editor → tick 'Copilot for Xcode'"
elif [[ "$MACOS_MAJOR" -eq 14 ]]; then
manual "System Settings → Privacy & Security → Extensions → Xcode Source Editor → tick 'Copilot'"
else
manual "System Preferences → Extensions → tick 'Copilot'"
fi

echo
echo " 2. Grant Accessibility API permission:"
manual "System Settings → Privacy & Security → Accessibility → add 'CopilotForXcodeExtensionService.app'"
echo " (Click 'Reveal Extension App in Finder' inside Copilot for Xcode.app to locate it.)"

echo
echo " 3. Sign in to GitHub Copilot inside the app:"
manual "Open Copilot for Xcode → Service → GitHub Copilot → Install → Sign In"

echo
echo " 4. (Optional) Set up key bindings in Xcode:"
manual "Xcode → Settings → Key Bindings → search 'copilot'"

echo
success "Installation complete! Follow the manual steps above, then restart Xcode."
echo
echo -e " ${CYAN}Full guide:${NC} https://github.com/intitni/CopilotForXcode#installation-and-setup"
echo -e " ${CYAN}Guía en español:${NC} https://github.com/intitni/CopilotForXcode/blob/main/INSTALL_ES.md"