switching-xcode-scheme

Reads and switches the active scheme of the focused Xcode workspace via AppleScript.

3.9k|1.2k|Updated Mar 18, 2013
One-click install
npx skills add https://github.com/wordpress-mobile/WordPress-iOS --skill switching-xcode-scheme
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: switching-xcode-scheme
Source: https://github.com/wordpress-mobile/WordPress-iOS/tree/main/.claude/skills/switching-xcode-scheme
Command: npx skills add https://github.com/wordpress-mobile/WordPress-iOS --skill switching-xcode-scheme

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

The Xcode MCP tools (BuildProject, RunSomeTests, RunAllTests) always operate on whatever scheme and destination are currently selected in the running Xcode app, and they accept no scheme or destination arguments. This Skill lets you inspect and change Xcode's active scheme programmatically so builds and tests target the intended scheme.

Core Features & Use Cases

  • Scheme switching: Set the active scheme of the focused Xcode workspace document, verified by read-after-write.
  • Scheme and destination listing: List all schemes and run destinations defined by the workspace, with optional case-insensitive substring filtering.
  • Workspace inspection: Print the path of the currently focused workspace document to confirm you are operating on the right window.
  • Use Case: Before invoking the Xcode MCP BuildProject tool, run the helper to confirm the active scheme is "WordPress"; if not, switch it, then trigger the build so the correct target compiles.

Quick Start

Ask the assistant to switch Xcode's active scheme to "WordPress" and then list the available run destinations before building the project.

Frequently Asked Questions about switching-xcode-scheme

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I change the active Xcode scheme from the command line?

Run the xcode-state.sh helper with the scheme subcommand followed by the exact scheme name, for example xcode-state.sh scheme "WordPress". It uses AppleScript to set the active scheme of the focused workspace document and verifies the change by reading it back.

How do I list all schemes in an Xcode workspace?

Run xcode-state.sh schemes to print every scheme defined by the focused workspace, one per line. Add a substring argument like xcode-state.sh schemes Jetpack to filter the list case-insensitively.

Can AppleScript change the active run destination in Xcode?

No, not reliably in Xcode 26.x. Reads of the active run destination property return missing value and writes silently no-op, so destination switching must be done manually in the Xcode toolbar or via UI scripting with Accessibility permission.

Why does the scheme switch fail with an error?

The script exits with code 1 when Xcode is not running, no workspace is open, or the scheme name does not match exactly. Run xcode-state.sh schemes first to get the exact name, since the set command does not accept substrings.

When should I use xcodebuild instead of driving the Xcode app?

Use xcodebuild when working from the command line rather than the running IDE, because it accepts -scheme and -destination flags directly. This AppleScript approach is only for controlling the Xcode application's UI state before invoking Xcode MCP tools.