| xctrace(1) | General Commands Manual | xctrace(1) |
xctrace — Record,
import, export, symbolicate and triage Instruments .trace files.
xctrace |
[command [options]] |
xctrace |
help [command] |
xctrace |
record [--output
path] [--append-run]
[--template path |
name] [--device
name | UDID]
[--run-name name]
[--time-limit time
[ms|s|m|h]] [--all-processes |
--attach pid |
name | --launch
command [arguments]]
[--target-stdin - |
file] [--target-stdout
- | file]
[--env VAR=value]
[--package file]
[--no-prompt]
[--notify-tracing-started
name]
|
xctrace |
import [--input
file] [--output
path] [--template
path | name]
[--run-name name]
[--package file] |
xctrace |
export file
[--output path]
[--toc | --xpath
expression] [--template
path | name]
[--instrument name]
[--package file]
[--time-start
time[ns|us|ms|s]]
[--time-end
time[ns|us|ms|s]]
[--duration
time[ns|us|ms|s]] |
xctrace |
remodel [--input
file] [--output
path] [--package
file] |
xctrace |
symbolicate [--input
file] [--output
path] [--dsym
file] |
xctrace |
triage [file]
[--process pid |
name] [--run
number | label]
--style hangs
[--limit count |
none] [--format
text | markdown] |
xctrace |
show [file]
--track path
(--calltree name |
--summary name |
--list name)
[--run number |
label] [--time-start
time[ns|us|ms|s]]
[--time-end time[ns|us|ms|s]
| --duration
time[ns|us|ms|s]] [--format
text | markdown]
[--sort column
[--ascending |
--descending]]
[--arrange-columns
expression] [--filter
column=value ...
[--match-all |
--match-any]]
[--minimum-value
column=value ...]
[--maximum-value
column=value ...]
[--hide-node-ids] [--focus
id [--title
label]]
[--hide-heaviest-stack]
[--include-source-info]
[--source node-id
[--source-mode source |
disassembly | interleave]
[--full-source]]
[--function expression ...]
[--resolve node-id ...]
[--list-functions] |
xctrace |
toc [file]
[--run number |
label] [--format
text | markdown] |
xctrace |
list [devices |
templates [--verbose] |
instruments [--verbose] | runs | tracks] |
xctrace is used to record new
Instruments.app .trace files using the specified recording template. It also
allows for converting supported converting files of supported input types
into .trace files and exporting data from .trace files to parseable formats
like xml. It can also inspect an already-recorded trace from the command
line: list its contents, print individual details such as call trees and
summaries, and triage it for hangs.
Available commands and their options:
helprecordxctrace. Recording can target all
processes, attach to an existing process or launch a new one.
--output
path--append-run is specified. In
this case the provided template will be ignored and the template in
the existing trace will be used. If the passed path is a directory, a
uniquely named file will be created in it. If the path contains the
extension .trace, a new trace will be created with that name at the
specified path or working directory.--append-run--run-name-t,
--template path |
namexctrace list
templates.-i,
--instrument namexctrace list
instruments.--device
name | UDIDsimulator is included, devices of simulator
types will be preferred. To get list of available devices, run
xctrace list
devices.-l,
--time-limit time
[ms|s|m|h]--window
duration [ms|s|m]--all-processes--attach
pid | name--launch
-- command
[arguments]xctrace command invocation.--package
file--target-stdin
- | filexctrace to be passed into the standard input
of a target process.--target-stdout
- | filexctrace.--env
VAR=value--no-prompt--notify-tracing-started
name--recording-options
file--show-recording-options and only keys for
instruments that are part of the recording are honored.--show-recording-options--all-processes,
--attach, --launch )
is not required when this flag is used.importxctrace export command.
--input
file--output
path--append-run is specified. In this case the
provided template will be ignored and the template in the existing
trace will be used.--append-run-t,
--template path |
namexctrace list
templates.--run-name
name-i,
--instrument namexctrace
list instruments.--package
fileexportIf the file passed to --input is not a
.trace bundle but a supported import format (for example .atrc or
.logarchive), it is imported in memory before the export runs. The same
default-template selection used by xctrace
import applies; the
--template,
--instrument, and
--package options may be supplied to override
it.
--input file option is
accepted as a legacy equivalent.--output
pathxctrace standard output.--toc--xpath
expression--toc;
attributes and text values cannot be exported on their own, so use
them as predicates to choose an entity instead, as in
‘/trace-toc/run[@number="1"]/data/table[@schema="time-profile"]’.
The command fails if the expression matches no exportable entity.--har--xpath or --toc; run
a separate export command for those.-t,
--template path |
namexctrace list
templates.-i,
--instrument namexctrace
list instruments.--package
file--time-start
time[ns|us|ms|s]ns for nanoseconds,
us for microseconds,
ms for milliseconds, or
s for seconds. Example: "--time-start
500ms". If omitted and --time-end or
--duration is specified, the start offset
defaults to 0 (the beginning of the trace). If
--time-end and
--duration are both omitted, the export
extends to the end of the trace.--time-end
time[ns|us|ms|s]--time-start. Mutually exclusive with
--duration. If
--time-start is omitted, the start offset is
implied to be 0. Example: "--time-end 1500ms".--duration
time[ns|us|ms|s]--time-start if provided, or at the
beginning of the trace if --time-start is
omitted. Accepts the same unit suffixes as
--time-start. Mutually exclusive with
--time-end. Example: "--duration
1s".remodelsymbolicate--input
file--output
path--dsym
pathtriage--input file option is
accepted as a legacy equivalent.--process
pid | name--run
number | label--style
hangs--limit
count | none-f,
--format text |
markdownshowxctrace toc to find the
track paths and detail names to pass.
Call trees and summaries are emitted with a node ID column.
--focus, --source, and
--resolve use this ID to select a node for an
operation; pass them alongside the same track, detail, run, time range,
and other filtering options.
--input file option is
accepted as a legacy equivalent.--track
pathTime
Profiler’ or ‘Calculator/Main
Thread’.--calltree
name--summary
name--list
name--run
number | label--time-start
time[ns|us|ms|s]--time-end
time[ns|us|ms|s]--duration
time[ns|us|ms|s]--time-end and
--duration cannot be specified together. If
--time-start is omitted, the range starts at
the beginning of the trace.-f,
--format text |
markdown--summary and --source
output is text only.--sort
column--source, ranks source lines instead, with
unsampled lines last.--ascending,
--descending--sort. Defaults to
--descending.--arrange-columns
expression...’ stands in for the
remaining default columns, so
‘Weight|...’ moves Weight to the
front. Columns hidden by default may be named. Not supported with
--summary or
--source.--filter
column=value--match-all,
--match-any--filter (the default),
or any one of them.--minimum-value
column=value--maximum-value
column=value--summary or
--list.--hide-node-ids--focus
id--summary.--title
label--focus.--hide-heaviest-stack--calltree.--include-source-info--calltree.--source
node-id--calltree.--source-mode
source | disassembly |
interleave--source.--full-source--source.--function
expressioninvert-calltree’ or
‘prune:<descriptor-json>’.
Repeatable. Requires --calltree.--list-functions--calltree.--resolve
node-id--function argument.
Repeatable. Requires --calltree.tocxctrace list tracks to
enumerate the tracks of one shape. A detail's focus destinations are
listed beneath it; see xctrace
show --focus.
--input file
option is accepted as a legacy equivalent.--run
number | label-f,
--format text |
markdownlist
deviceslist
templatesxctrace.
These include Instruments.app bundled templates, templates from installed
Instruments Packages and custom templates installed into Application
Support directory for Instruments.app.
-v,
--verboselist
instruments-v,
--verboselist
runs--input file option is
accepted as a legacy equivalent.list
tracksxctrace toc. Each listed
path can be passed to xctrace
show --track.
--input file option is
accepted as a legacy equivalent.--type
pathProcess/Thread’. Required.--run
number | label-q,
--quietInstruments.app may be used to perform trace recordings in a
graphical environment and may also be used to open trace documents created
by xctrace.
Import a logarchive file to the trace file with a unique name using a MyCustomTemplate template:
% xctrace import --input
system_logs.logarchive --template 'MyCustomTemplate'Import a ktrace file into a new document created from the template with name MyCustomTemplate and adding the instrument from /tmp/PackageToLoad.instrdst and save the resulting document as output.trace:
% xctrace import --input
trace001.ktrace --template 'MyCustomTemplate' --package
'/tmp/PackageToLoad.instrdst' --output output.traceImport a ktrace file with a custom run name:
% xctrace import --input
trace001.ktrace --template 'System Trace' --run-name 'Baseline Trace' --output
system.traceExport a table of contents (toc) of the input.trace file to standard output:
% xctrace export input.trace
--tocExport recorded data from a table with my-table-schema schema in the first run of the input.trace file to standard output:
% xctrace export input.trace --xpath
'/trace-toc/run[@number="1"]/data/table[@schema="my-table-schema"]'Export UUID, binary path, load address and architecture for each binary image contained in the first run of the input.trace and save as output.xml:
% xctrace export input.trace --output
output.xml --xpath
'/trace-toc/run[@number="1"]/processes'Export UUID, binary path, load address and architecture for each binary image used by the process named my-process-name in the first run of the input.trace file to standard output:
% xctrace export input.trace --xpath
'/trace-toc/run[@number="1"]/processes/process[@name="my-process-name"]'Export the table of contents directly from a. atrc
file without first running xctrace
import:
% xctrace export --input trace.atrc
--tocStart recording all processes on the local Mac device using the Time Profiler template and automatically stop the recording after 5s:
% xctrace record --all-processes
--template 'Time Profiler' --time-limit 5sStart a new recording by attaching to the process with name Trailblazer on the connected device Chad's iPhone using the template Time Profiler:
% xctrace record --template 'Time
Profiler' --device-name 'Chad's iPhone' --attach 'Trailblazer'Start Metal System Trace template recording on a simulator device named iPhone SE Simulator, capturing all existing processes:
% xctrace record --template 'Metal
System Trace' --device-name 'iPhone SE Simulator' --all-processesStart Time Profiler template recording on a local Mac device, launching and profiling binary at /tmp/tool path with arg1 arg2 arguments, output of the binary gets redirected to the standard output:
% xctrace record --template 'Time
Profiler' --target-stdout - --launch -- /tmp/tool arg1 arg2Symbolicate the input.trace file using debug information from a SomeLibrary.dSYM file:
% xctrace symbolicate --input
input.trace --dsym SomeLibrary.dSYMSymbolicate the input.trace file by trying automatically locate debug information:
% xctrace symbolicate --input
input.traceReport the hangs of the process the recording.trace file was recorded against:
% xctrace triage recording.trace
--style hangsReport the hangs of the process named
Calculator
in an atrc file, without first running
xctrace import:
% xctrace triage --input hangs.atrc
--process Calculator --style hangsReport the five longest hangs of the process with pid 79311 in the second run of the recording.trace file:
% xctrace triage recording.trace
--process 79311 --run 2 --style hangs --limit 5List the tracks and details in recording.trace:
% xctrace toc
recording.traceList the thread tracks in recording.trace:
% xctrace list tracks recording.trace
--type 'Process/Thread'Print the Profile call tree of the Time Profiler track for one second starting at 2s:
% xctrace show recording.trace
--track 'Time Profiler' --calltree 'Profile' --time-start 2s --duration
1sPrint the Run Loop Busy Intervals list of a process' main thread, longest first:
% xctrace show recording.trace
--track 'Calculator/Main Thread' --list 'Run Loop Busy Intervals' --sort
DurationFollow the Updates focus destination of a summary row:
% xctrace show recording.trace
--track 'SwiftUI' --summary 'Summary: All Updates' --focus 12885208744:1
--title 'Updates'Print the annotated disassembly of a call tree node:
% xctrace show recording.trace
--track 'Time Profiler' --calltree 'Profile' --source 12885208744:5
--source-mode disassembly| October 2, 2026 | macOS |