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:

General help or help specific to command argument
Perform a new recording on the specified device and target with the given template. Resulting .trace file can be viewed in Instruments.app or exported using xctrace. Recording can target all processes, attach to an existing process or launch a new one.
path
Save the trace to the specified path. A path to an existing trace file can be used if --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.
Allows to target an existing trace file. Specifying it causes new run to be appended. New run is recorded with the template that this existing trace file was initially recorded with.
Specifies run name for this recording, which can be later inspected in Instruments.app.
, --template path | name
Records using given trace template name or path. If name is specified, template needs to be either bundled with an installed Instruments Package or located in the Application Support directory for Instruments. To retrieve available templates, run xctrace list templates.
, --instrument name
Adds Instrument with the specified name to the recording configuration. To retrieve available Instruments, run xctrace list instruments.
name | UDID
Record on a device with the given name or UDID. If not specified, then local device is chosen for the recording. If the word simulator is included, devices of simulator types will be preferred. To get list of available devices, run xctrace list devices.
, --time-limit time [ms|s|m|h]
Limits the recording to the specified time period. Example: "--time-limit 5s" or "--time-limit 1m"
duration [ms|s|m]
Configure trace to operate in windowed mode, where trace buffer acts as a ring buffer, removing old events to make room for new ones. Example: "--window 5s"
Record all processes running on the system.
pid | name
Attach and record running process with the given name or pid.
-- command [arguments]
Launch and record process with the given name or path and provided arguments list. This option should be passed as the last one in the xctrace command invocation.
file
Install the given Instruments Package temporarily for the duration of a command
- | file
Redirects standard input stream of a launched process in case if target device is set to the local Mac. Can be pointing to a file or be specified as - , which causes standard input of xctrace to be passed into the standard input of a target process.
- | file
Redirects standard output stream of a launched process. Can be pointing to a file or be specified as - , which causes standard output of a target process to be to be redirected into the standard output of xctrace.
VAR=value
Sets environment variable for a launched process. Example: "--env PATH=/tmp"
Skip any prompts that would be otherwise presented (like privacy warnings)
name
Send Darwin notification with this name when a recording has started.
file
Apply recording options for the selected instruments from the given JSON file. The file format matches the output of --show-recording-options and only keys for instruments that are part of the recording are honored.
Do not start a recording. Instead, print the configurable recording options for the selected template and instruments as JSON and exit. Instruments that have no configurable recording options are omitted from the output. A target option ( --all-processes, --attach, --launch ) is not required when this flag is used.

If the specified file is of a support input format, imports the file into an Instruments .trace file using the specified template. This file can later be viewed using Instruments.app or exported by using xctrace export command.
file
Import data from a supported file format at the given path.
path
Save the trace to the specified path. Existing trace files cannot be targeted. If the passed path is a directory, a uniquely named file will be created in it. A path to an existing trace file can be used if --append-run is specified. In this case the provided template will be ignored and the template in the existing trace will be used.
Allows to target an existing trace file. Specifying it causes new run to be appended. New run is imported into the original template the trace was created with.
, --template path | name
Imported using given trace template name or path. Only data that is needed by Instruments contained in the template will be imported. If name is specified, template needs to be either bundled with an installed Instruments Package or located in the Application Support directory for Instruments. To retrieve available templates, run xctrace list templates.
name
Specifies run name for this import, which can be later inspected in Instruments.app.
, --instrument name
Adds Instrument with the specified name to the import configuration. To retrieve available Instruments, run xctrace list instruments.
file
Install the given Instruments Package temporarily for the duration of a command.

Exports a trace file into an XML format. Output contains metadata about the trace, raw data stored in tables and view-level aggregated data. Table of contents query describes the structure of available data for a given trace.

If 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.

file
Path to the trace file to export data from. Passing the trace file as a positional argument is the preferred form. A supported import-format file (for example .atrc or .logarchive) may be supplied instead of a .trace bundle; it will be implicitly imported before export. The --input file option is accepted as a legacy equivalent.
path
Save output of the export operation to the given path. If not specified, then textual output is being written to the xctrace standard output.
Export the table of contents of a trace file. This will contain overview of content and exportable entities from the given trace file.
expression
Perform given XPath query on the table of contents to select entities to export from the given trace file. Selected entities will be present in the export command output. The expression has to select entities, that is, the elements listed by --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.
Export data as the HTTP Archive file if the trace run contains the HTTP Traffic Instrument. Cannot be combined with --xpath or --toc; run a separate export command for those.
, --template path | name
Template used for the implicit import of a non-.trace input. Ignored when the input is already a .trace bundle. If a name is specified, template needs to be either bundled with an installed Instruments Package or located in the Application Support directory for Instruments. To retrieve available templates, run xctrace list templates.
, --instrument name
Adds Instrument with the specified name to the implicit-import configuration. Ignored when the input is already a .trace bundle. To retrieve available Instruments, run xctrace list instruments.
file
Install the given Instruments Package temporarily for the duration of a command. Useful for making additional importers available to the implicit-import phase.
time[ns|us|ms|s]
Restrict exported data to begin at the specified trace-relative offset. The value is a trace-relative timestamp — the amount of time elapsed since the start of the trace run. A unit suffix is required: use 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[ns|us|ms|s]
Restrict exported data to end at the specified trace-relative offset. Accepts the same unit suffixes as --time-start. Mutually exclusive with --duration. If --time-start is omitted, the start offset is implied to be 0. Example: "--time-end 1500ms".
time[ns|us|ms|s]
Restrict exported data to a window of the specified length. The window begins at --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".

Remodel trace using currently installed packages and their modelers.
file
Remodel data from .trace file at the given path.
path
Save remodeled .trace file to the given path. .
file
Install the given Instruments Package temporarily for the duration of a command.

Symbolicate trace file using supplied debug symbols (dSYM).
file
Symbolicate addresses in .trace file at the given path.
path
Save symbolicated .trace file to the given path. If not specified, the symbolicated .trace will be saved to its original location (input path).
path
Use symbol data from dSYM at given path. Path can be a dSYM or a directory to search recursively for dSYMs. If not specified, the tool will make its best effort to locate dSYMs (it may take a while).

Analyze an already-recorded trace and report the hangs it holds for a single process. Each hang is reported with what the process' main thread was doing while it was hung. The trace has to include Hangs and Time Profiler instruments.
file
Triage the .trace or .atrc file at the given path. An input that is not a .trace bundle is imported first. The --input file option is accepted as a legacy equivalent.
pid | name
Triage the process with the given pid or name. Does not need to be specified if there was a single process targeted in the trace.
number | label
Triage the run with the given number or label. Does not need to be specified if the trace only has one run.
hangs
Select performance focus for triage. Required.
count | none
Report at most count hangs, longest first. Defaults to 10. Pass none to report every hang.
, --format text | markdown
Print the report in the given format. Defaults to text.

Show a detail (a call tree, summary, or list) from the trace. Use xctrace 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.

file
Show data from the .trace or .atrc file at the given path. An input that is not a .trace bundle is imported first. The --input file option is accepted as a legacy equivalent.
path
The track to read, given as a '/'-separated path of displayed track titles, for example ‘Time Profiler’ or ‘Calculator/Main Thread’.
name
 
name
 
name
Show the call tree, summary, or list detail with the given name. Exactly one must be specified.
number | label
Show data from the run with the given number or label. Does not need to be specified if the trace only has one run.
time[ns|us|ms|s]
 
time[ns|us|ms|s]
 
time[ns|us|ms|s]
Restrict the shown data to a trace-relative time range. A unit suffix is required. --time-end and --duration cannot be specified together. If --time-start is omitted, the range starts at the beginning of the trace.
, --format text | markdown
Print the detail in the given format. Defaults to text. --summary and --source output is text only.
column
Order rows by the column with the given title, largest first. With --source, ranks source lines instead, with unsampled lines last.
, --descending
Sort smallest or largest first. Requires --sort. Defaults to --descending.
expression
Select and order columns by title, separated by '|'. ‘...’ 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.
column=value
Keep only rows whose column matches value. column is a column title or mnemonic. Repeatable.
, --match-any
Rows must match every --filter (the default), or any one of them.
column=value
 
column=value
Keep only rows whose column value is at least, or at most, value, given in the column's units (e.g. 10ms, 5MB, 40). Repeatable. Only valid with --summary or --list.
Do not print the leading ID column.
id
Follow the focus action of the summary row with the given ID and show the detail behind it. A summary's focus destinations are listed beneath its rows. Requires --summary.
label
Pick which focus destination to follow when the row has more than one. Requires --focus.
Do not print the heaviest stack trace above the call tree. Requires --calltree.
Print the source file and line number of each call tree symbol. Requires --calltree.
node-id
Print the annotated source of the call tree node with the given ID, with per-line weights. Requires --calltree.
source | disassembly | interleave
Annotate source lines, disassembled instructions, or source with its instructions interleaved. Defaults to source. Requires --source.
Print the whole source file rather than only the selected symbol. Requires --source.
expression
Apply a call tree function before printing. expression is a function name with an optional ':'-separated argument, such as ‘invert-calltree’ or ‘prune:<descriptor-json>’. Repeatable. Requires --calltree.
List the call tree functions available on the call tree, and the arguments each accepts, then exit. Requires --calltree.
node-id
Print the symbol descriptor JSON for the call tree node with the given ID, for use as a --function argument. Repeatable. Requires --calltree.

Print a trace's static tracks (e.g. one per instrument) as a tree, with the details available on each listed inline. Dynamic tracks (processes, threads, and similar per-instance tracks) are not listed individually. Instead, each distinct dynamic-track shape (e.g. “Process”, “Process/Thread”) is listed once in a separate “Details for dynamic tracks” section. Use xctrace list tracks to enumerate the tracks of one shape. A detail's focus destinations are listed beneath it; see xctrace show --focus.
file
Show the table of contents for the .trace or .atrc file at the given path. The --input file option is accepted as a legacy equivalent.
number | label
Show the run with the given number or label. Does not need to be specified if the trace only has one run.
, --format text | markdown
Print the table of contents in the given format. Defaults to text.

Lists all of non-host devices that can be used as a target for a new recording.
Lists all of templates that are known to xctrace. These include Instruments.app bundled templates, templates from installed Instruments Packages and custom templates installed into Application Support directory for Instruments.app.
, --verbose
Print each template's description, indented below its name.
Lists all of the Instruments available to select as part of the record or import workflow.
, --verbose
Print each instrument's description, indented below its name.
Lists the number and label of each run contained in a .trace document.
file
List the runs in the .trace file at the given path. The --input file option is accepted as a legacy equivalent.
Lists the tracks of one dynamic-track shape, as printed by xctrace toc. Each listed path can be passed to xctrace show --track.
file
List the tracks in the .trace or .atrc file at the given path. The --input file option is accepted as a legacy equivalent.
path
The '/'-separated dynamic-track shape to enumerate, for example ‘Process/Thread’. Required.
number | label
List the tracks of the run with the given number or label. Does not need to be specified if the trace only has one run.

Global options:
, --quiet
Make terminal output less verbose

Instruments.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 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 and save the resulting document as :

% xctrace import --input trace001.ktrace --template 'MyCustomTemplate' --package '/tmp/PackageToLoad.instrdst' --output output.trace

Import a ktrace file with a custom run name:

% xctrace import --input trace001.ktrace --template 'System Trace' --run-name 'Baseline Trace' --output system.trace

Export a table of contents (toc) of the input.trace file to standard output:

% xctrace export input.trace --toc

Export recorded data from a table with 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 :

% 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 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 --toc

Start recording all processes on the local Mac device using the Time Profiler template and automatically stop the recording after :

% xctrace record --all-processes --template 'Time Profiler' --time-limit 5s

Start a new recording by attaching to the process with name on the connected device using the template Time Profiler:

% xctrace record --template 'Time Profiler' --device-name 'Chad's iPhone' --attach 'Trailblazer'

Start template recording on a simulator device named , capturing all existing processes:

% xctrace record --template 'Metal System Trace' --device-name 'iPhone SE Simulator' --all-processes

Start Time Profiler template recording on a local Mac device, launching and profiling binary at path with arguments, output of the binary gets redirected to the standard output:

% xctrace record --template 'Time Profiler' --target-stdout - --launch -- /tmp/tool arg1 arg2

Symbolicate the input.trace file using debug information from a file:

% xctrace symbolicate --input input.trace --dsym SomeLibrary.dSYM

Symbolicate the input.trace file by trying automatically locate debug information:

% xctrace symbolicate --input input.trace

Report the hangs of the process the recording.trace file was recorded against:

% xctrace triage recording.trace --style hangs

Report the hangs of the process named in an atrc file, without first running xctrace import:

% xctrace triage --input hangs.atrc --process Calculator --style hangs

Report the five longest hangs of the process with pid in the run of the recording.trace file:

% xctrace triage recording.trace --process 79311 --run 2 --style hangs --limit 5

List the tracks and details in recording.trace:

% xctrace toc recording.trace

List the thread tracks in recording.trace:

% xctrace list tracks recording.trace --type 'Process/Thread'

Print the 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 1s

Print the list of a process' main thread, longest first:

% xctrace show recording.trace --track 'Calculator/Main Thread' --list 'Run Loop Busy Intervals' --sort Duration

Follow the 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