axiom-xctrace-ref
Use when automating Instruments profiling, running headless performance analysis, or integrating profiling into CI/CD - comprehensive xctrace CLI reference…
by ComeOnOliver★ 67 GitHub stars
Install axiom-xctrace-ref in Claude Code & Claude Desktop
Sign up to install this skill
Create a free account to reveal the install command and save the skill to your library.
- Reveal the one-line install command
- Save skills to your synced library
- Get notified when skills update
About this skill
xctrace CLI Reference
Command-line interface for Instruments profiling. Enables headless performance analysis without GUI.
Overview
xctrace is the CLI tool behind Instruments.app. Use it for:
- Automated profiling in CI/CD pipelines
- Headless trace collection without GUI
- Programmatic trace analysis via XML export
- Performance regression detection
Requires: Xcode 12+ (xctrace 12.0+). This reference tested with Xcode 26.2.
Quick Reference
# Record a 10-second CPU profile
xcrun xctrace record --instrument 'CPU Profiler' --attach 'MyApp' --time-limit 10s --output profile.trace
# Export to XML for analysis
xcrun xctrace export --input profile.trace --toc # See available tables
xcrun xctrace export --input profile.trace --xpath '/trace-toc/run[@number="1"]/data/table[@schema="cpu-profile"]'
# List available instruments
xcrun xctrace list instruments
# List available templates
xcrun xctrace list templates
Recording Traces
Basic Recording
# Using an instrument (recommended for CLI automation)
xcrun xctrace record --instrument 'CPU Profiler' --attach 'AppName' --time-limit 10s --output trace.trace
# Using a template (may fail on export in Xcode 26+)
xcrun xctrace record --template 'Time Profiler' --attach 'AppName' --time-limit 10s --output trace.trace
Note: In Xcode 26+, use --instrument instead of --template for reliable export. Templates may produce traces with "Document Missing Template Error" on export.
Target Selection
# Attach to running process by name
xcrun xctrace record --instrument 'CPU Profiler' --attach 'MyApp' --time-limit 10s
# Attach to running process by PID
xcrun xctrace record --instrument 'CPU Profiler' --attach 12345 --time-limit 10s
# Profile all processes
xcrun xctrace record --instrument 'CPU Profiler' --all-processes --time-limit 10s
# Launch and profile
xcrun xctrace record --instrument 'CPU Profiler' --launch -- /path/to/app arg1 arg2
# Target specific device (simulator or physical)
xcrun xctrace record --instrument 'CPU Profiler' --device 'iPhone 17 Pro' --attach 'MyApp' --time-limit 10s
xcrun xctrace record --instrument 'CPU Profiler' --device 947DF45C-4ACB-4B3E-A043-DF2CD59A59B3 --all-processes --time-limit 10s
Recording Options
| Flag | Description |
|---|---|
--output <path> |
Output .trace file path |
--time-limit <time> |
Recording duration (e.g., 10s, 1m, 500ms) |
--no-prompt |
Skip privacy warnings (use in automation) |
--append-run |
Add run to existing trace |
--run-name <name> |
Name the recording run |
Core Instruments
CPU Profiler
CPU sampling for finding hot functions.
xcrun xctrace record --instrument 'CPU Profiler' --attach 'MyApp' --time-limit 10s --output cpu.trace
Schema: cpu-profile
Columns: time, thread, process, core, thread-state, weight (cycles), stack
Allocations
Memory allocation tracking.
xcrun xctrace record --instrument 'Allocations' --attach 'MyApp' --time-limit 30s --output alloc.trace
Schema: allocations
Use for: Finding memory growth, object counts, allocation patterns
Leaks
Memory leak detection.
xcrun xctrace record --instrument 'Leaks' --attach 'MyApp' --time-limit 30s --output leaks.trace
Schema: leaks
Use for: Detecting unreleased memory, retain cycles
SwiftUI
SwiftUI view body analysis.
xcrun xctrace record --instrument 'SwiftUI' --attach 'MyApp' --time-limit 10s --output swiftui.trace
Schema: swiftui
Use for: Finding excessive view updates, body re-evaluations
Swift Concurrency
Actor and Task analysis.
xcrun xctrace record --instrument 'Swift Tasks' --instrument 'Swift Actors' --attach 'MyApp' --time-limit 10s --output concurrency.trace
Schemas: swift-task, swift-actor
Use for: Task scheduling, actor isolation, async performance
All Available Instruments
Activity Monitor Audio Client Audio Server
Audio Statistics CPU Counters CPU Profiler
Core Animation Activity Core Animation Commits Core Animation FPS
Core Animation Server Core ML Data Faults
Data Fetches Data Saves Disk I/O Latency
Disk Usage Display Filesystem Activity
Filesystem Suggestions Foundation Models Frame Lifetimes
GCD Performance GPU HTTP Traffic
Hangs Hitches Leaks
Location Energy Model Metal Application Metal GPU Counters
Metal Performance Overview Metal Resource Events Network Connections
Neural Engine Points of Interest Power Profiler
Processor Trace RealityKit Frames RealityKit Metrics
Runloops Sampler SceneKit Application
Swift Actors Swift Tasks SwiftUI
System Ca
Allowed tools
Tools this skill is permitted to call.
No restriction — this skill can use any tool.
FAQ
What does the axiom-xctrace-ref skill do?
Use when automating Instruments profiling, running headless performance analysis, or integrating profiling into CI/CD - comprehensive xctrace CLI reference with record/export patterns
How do I install the axiom-xctrace-ref skill?
Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.
Does the axiom-xctrace-ref skill run scripts?
No, this skill is instructions only (SKILL.md) with no executable scripts.
Related skills
skill-creator
AnthropicCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
discernment-nudge
AnthropicAfter you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
data-consolidate
AnthropicJoins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
inspection-to-capa
AnthropicRuns the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…