| name | install-xcode |
| description | Install a specific Xcode version on a Mac using the xcodes CLI, handing the Apple ID sign-in (password + 2FA) to the user through a shared live terminal. Use when a task needs Xcode/simulators and the machine doesn't have the right version, or the user asks to install/upgrade Xcode. |
Install Xcode
Install Xcode non-interactively where possible, and hand exactly one step — the Apple ID sign-in — to the user via a shared terminal. Never ask the user to paste Apple credentials into chat.
0. Check the platform
Xcode only runs on macOS. Check uname -s first — if it prints Linux, stop: this machine cannot install Xcode. Tell the user they need to use EAS (Expo Application Services) to build for iOS from this machine instead.
1. Check what's needed
- Already installed?
ls /Applications | grep -i xcode and xcodebuild -version. If the right version is present, stop.
- Pick the version the work actually needs, not the newest. For repo work, match CI: look for
.xcode-version, or grep -rn 'Xcode_\|xcode-select --switch' .github/workflows/ in the target repo (e.g. expo/expo pins the version in ios-unit-tests.yml). Fall back to latest release.
- Disk: Xcode needs ~20 GB installed plus ~8 GB for a simulator runtime, and unxip needs headroom. Check
df -h / and don't start below ~50 GB free.
2. Get the xcodes CLI
Prefer the prebuilt binary — brew install xcodesorg/made/xcodes builds from source and fails on machines with stale Command Line Tools (error: xcbuild ... does not exist), which is likely on a box that doesn't have Xcode yet:
curl -sL -o /tmp/xcodes.zip https://github.com/XcodesOrg/xcodes/releases/latest/download/xcodes.zip
cd /tmp && unzip -o -q xcodes.zip && +x xcodes
-p /tmp/cbin && /tmp/xcodes /tmp/cbin/xcodes