Xcode Selector
Status bar scheme and destination picker for Xcode projects in VS Code.
This extension helps you quickly select:
- The active Xcode scheme
- The active destination (simulator or physical device)
Selections are persisted in VS Code workspace state and exported to:
.vscode/xcode-selection.json
That file is intended for build/run scripts that need to know the currently selected scheme and destination.
Features
- Two status bar controls:
- Scheme picker (
$(tools))
- Destination picker (
$(device-mobile))
- Auto-detects an
.xcworkspace in the workspace root
- Optional manual workspace path configuration
- Fast QuickPick behavior with in-memory cache and refresh command
- Destination ID normalization for
xcrun workflows:
- Simulator IDs from
xcrun simctl
- Physical device IDs from
xcrun devicectl
Commands
Xcode: Select Scheme (xcode-selector.selectScheme)
Xcode: Select Destination (xcode-selector.selectDestination)
Xcode: Refresh Schemes & Destinations (xcode-selector.refresh)
Configuration
Setting:
xcode-selector.workspacePath (string, default: empty)
Behavior:
- If empty, the extension scans the workspace root and uses the first
.xcworkspace it finds.
- If set, it can be:
- A relative path from workspace root (recommended)
- An absolute path
Example in .vscode/settings.json:
{
"xcode-selector.workspacePath": "SafePilot.xcworkspace"
}
Output File
The extension writes selection data to:
.vscode/xcode-selection.json
Schema:
{
"scheme": "SafePilot",
"destination": {
"id": "A1B2C3D4-E5F6-7890-1234-56789ABCDEF0",
"xcrunId": "A1B2C3D4-E5F6-7890-1234-56789ABCDEF0",
"name": "iPhone 16 Pro",
"os": "18.0",
"platform": "iOS Simulator",
"destType": "iOSSimulator"
}
}
Notes:
destination.id is the identifier used with xcodebuild -destination id=....
destination.xcrunId is populated when available and should be preferred for xcrun install flows.
destination is null until a destination is selected.
Usage
- Open a folder containing an Xcode workspace.
- Click the scheme item in the status bar and choose a scheme.
- Click the destination item in the status bar and choose a device/simulator.
- Use the refresh command after plugging in a new device or changing simulator availability.
Script Integration Example
You can consume .vscode/xcode-selection.json in shell scripts:
#!/usr/bin/env bash
set -euo pipefail
selection_file=".vscode/xcode-selection.json"
scheme="$(jq -r '.scheme // empty' "$selection_file")"
dest_id="$(jq -r '.destination.id // empty' "$selection_file")"
if [[ -z "$scheme" || -z "$dest_id" ]]; then
echo "Missing scheme or destination in $selection_file"
exit 1
fi
xcodebuild \
-workspace SafePilot.xcworkspace \
-scheme "$scheme" \
-destination "id=$dest_id" \
build
Requirements
- macOS with Xcode command line tools installed
xcodebuild available on PATH
- For full device/simulator resolution:
xcrun simctl
xcrun devicectl
Troubleshooting
No workspace found
If you see:
xcode-selector: no .xcworkspace found. Set xcode-selector.workspacePath in settings.
Set xcode-selector.workspacePath to your workspace path in settings.
No destinations found
- Ensure a scheme is selected first.
- Confirm the scheme supports your target platform.
- Run the refresh command after simulator/device changes.
Device identifiers look inconsistent
Different tools can report different IDs for the same physical device. The extension attempts to normalize IDs by matching selected destinations with xcrun output.
Development
npm install
npm run compile
Watch mode:
npm run watch
Then open this folder in VS Code and run the extension in an Extension Development Host (F5).
Packaging
If you use vsce, typical flow:
npm run compile
npx @vscode/vsce package
This produces a .vsix file for local install/testing.