I was reading through this documentation about instruments command line tool https://help.apple.com/instruments/mac/current/#/devb14ffaa5 and how it can be launched from the command line. However, unlike what the documentation states, there's no such instruments command anywhere on my macos M1 (OS version 15.6). That command gives:
$> instruments
zsh: command not found: instruments
I do have XCode installed which has the Instruments.App (GUI app) but not the command line utility:
$> ls Xcode.app/Contents/Applications/
... Instruments.app
Is that linked documentation up-to-date (it does say "latest" in the URL)? Is there some other way to install this command line utility?
Instruments
RSS for tagInstruments is a performance-analysis and testing tool for iOS, iPadOS, watchOS, tvOS, and macOS apps.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
I tried using Create ML of Xcode 26.0 beta 7 to generate a model using the "Word Tagging" template, and I received the error: Training progress unavailable - Unexpected error.
Using Create ML of XCode 16.4 with the same documentation, I was able to build the model and use it in a test app.
I'd like to understand why Create ML of Xcode 26 no longer works.
Topic:
Developer Tools & Services
SubTopic:
Instruments
According to the ARM documentation for the CPU models available in Apple Silicon, the CoreSight implementation includes an Embedded Trace Macrocell which can perform a complete "Instruction Trace" (https://developer.arm.com/documentation/102119/0200/What-is-trace-). Although other operating systems such as Linux make this easy, we have not been able to find any tools or even a system-level API for accessing this feature of the ETM.
In the "Instruments" window of Xcode 16+, there is a "Processor Trace" instrument, but this performs sampling and is totally unrelated to the Instruction Trace we need for debugging and analysis purposes. Because it produces a complete, contiguous sequence of branch instructions, the Instruction Trace is essential for identifying precise execution behaviors that are otherwise invisible to the developer. On other platforms, an alternative is debugger scripting, but we have found far too many bugs and reliability issues with the macOS implementation of lldb.
Any suggestions would be greatly appreciated!
Topic:
Developer Tools & Services
SubTopic:
Instruments
Hello Apple team,
I am using xctrace to record an Allocations trace on iOS. For example:
xctrace record
--template "Allocations"
--launch com.example.myapp
--time-limit 30s
--output alloc.trace
After recording, I can export the results in Allocations List format (flat list of allocations) using:
xcrun xctrace export --input ./alloc.trace --xpath '/trace-toc/run/tracks/track[@name="Allocations"]/details/detail[@name="Allocations List"]' --output ./alloc.xml
This works fine and produces an XML output.
However, what I really need is to export the data in Call Tree format (as shown in Instruments GUI). I checked xctrace export --help, but it seems that the Allocations template only supports the List view for export, not the Call Tree breakdown.
My question is:
👉 Is there a way to export an Allocations trace in XML with Call Tree details using xctrace?
👉 If not, is there an API or recommended workflow to automate this instead of exporting manually from Instruments GUI?
Thanks in advance for your help!
Topic:
Developer Tools & Services
SubTopic:
Instruments
Hiya folks! I'm David and I work on rust-analyzer, which is a language server for Rust similar to sourcekit-lsp. I'm using the new Instruments profiling tooling functionality in Xcode 16.3 and Xcode 26 (Processor Trace and CPU Counters) to profile our trait solver/type checker. While I've been able to use the new CPU Counters instrument successfully (the CPU Bottleneck feature is incredible! Props to the team!), I've been unable to make use of the Processor Trace instrument.
Instruments gives me the error message "Processor Trace cannot profile this process without proper permissions". The diagnostic suggests adding the com.apple.security-get-task-allow entitlement to the code I'm trying to profile, or ensure that the build setting CODE_SIGN_INJECT_BASE_ENTITLEMENTS = YES is enabled in Xcode.
Unfortunately, I don't know how I can add that entitlement to a self-signed binary produced by Cargo and I'm not using Xcode for somewhat obvious reasons.
Here's some information about my setup:
Instruments Version 26.0 (17A5241e)
I'm on an 14" MacBook Pro with M4 Pro. It's running macOS Version 26.0 Beta (25A5295e).
I've enabled the "Processor Trace" feature in "Developer Tools" and even added the Instruments application to "Developer Tools".
As a last-ditch effort before posting this, I disabled SIP on my Mac. Didn't help.
To reproduce my issue:
Get Rust via https://rustup.rs/.
Clone rust-analyzer: git clone https://github.com/rust-lang/rust-analyzer.git.
cd rust-analyzer
Run cargo test --package hir-ty --lib --profile=dev-rel -- tests::incremental::add_struct_invalidates_trait_solve --exact --show-output. By default, this command will output a bunch of build progress with the output containing something like Running unittests src/lib.rs (target/dev-rel/deps/hir_ty-f1dbf1b1d36575fe).
I take the absolute path of that hir_ty-$SOME-HASH string (in my case, it looks like /Users/dbarsky/Developer/rust-analyzer/target/dev-rel/deps/hir_ty-f1dbf1b1d36575fe) and add it to the "Launch" profile. To the arguments section, I add --exact tests::incremental::add_struct_invalidates_trait_solve.
I then try to record/profile via Instruments, but then I get the error message I shared above.
Below is output of codesign -dvvv:
❯ codesign -dvvv target/dev-rel/deps/hir_ty-f1dbf1b1d36575fe
Executable=/Users/dbarsky/Developer/rust-analyzer/target/dev-rel/deps/hir_ty-f1dbf1b1d36575fe
Identifier=hir_ty-f1dbf1b1d36575fe
Format=Mach-O thin (arm64)
CodeDirectory v=20400 size=140368 flags=0x20002(adhoc,linker-signed) hashes=4383+0 location=embedded
Hash type=sha256 size=32
CandidateCDHash sha256=99e96c8622c7e20518617c66a7d4144dc0daef28
CandidateCDHashFull sha256=99e96c8622c7e20518617c66a7d4144dc0daef28f22fac013c28a784571ce1df
Hash choices=sha256
CMSDigest=99e96c8622c7e20518617c66a7d4144dc0daef28f22fac013c28a784571ce1df
CMSDigestType=2
CDHash=99e96c8622c7e20518617c66a7d4144dc0daef28
Signature=adhoc
Info.plist=not bound
TeamIdentifier=not set
Sealed Resources=none
Internal requirements=none
Any tips would be welcome! Additionally—and perhaps somewhat naively—I think I'd expect the Processor Trace instrument to just work with an adhoc-signed binary, as lldb and friends largely do—I'm not sure that such a high barrier for CPU perf counters is warranted, especially on an adhoc-signed binary.
I'm currently exploring Instruments for profiling and tracing on macOS 15.6.1. I know there is the "network connections" instrument which records TCP/UDP information, however it seems to not include the "lo0" (loopback) interface.
Is there a way to configure it so that localhost traffic is included in the recording? as the application I'm tracing uses that and I want that information to be included in traces.
The documentation for network-interface-detection schema makes no mention of how it detects interfaces.
Thanks in advance.
According to the documentation for Processor Trace, it should be available on the iPhone 16 or later.
Going off of the Optimize CPU performance with Instruments WWDC session, the toggle for it should be under Developer > Performance, but I don’t see this option anywhere on my iPhone 17. I can’t run a Processor Trace in Instruments without this feature turned on, because it claims my iPhone’s CPU is unsupported.
Has anyone else managed to enable Processor Trace on the A19 chips?
I'm working on a custom instrument that displays intervals from os_signpost data. I'd like to color the intervals in the graph based on data from an accompanying aggregate. For example, color the interval red if its duration is greater than 3 standard deviations from the mean. Is this possible?
Topic:
Developer Tools & Services
SubTopic:
Instruments
Hello, I am trying to investigate my apps memory usage using the instruments tool. Whenever I attach instruments my app crashes, when I have it connected to xcode as well I can see that the crash occurs in liboainject: ___lldb_unamed_symbol117 with SIGBUS.
Here's what the stack looks like.
Is this a known issue? Are there any workarounds or things I can do to figure out what is causing the crash?
Topic:
Developer Tools & Services
SubTopic:
Instruments
When creating an icon using icon composer, I cant upload a build to testflight/App Store connect.
Running on device from Xcode works fine, but as soon as I archive and upload to App Store Connect, I get an error saying the icon contains an alpha channel
Hello,
I'm no macOS 26.1 I'm running through the example shown in the WWDC video "Optimizing CPU Performance with Instruments." After right-clicking a test, clicking "Profile...", and trying to run a processor trace I get the error in the subject.
I have processor trace enabled on the CPU via system settings. I confirmed this by disabling it and re-enabling it and noting the error that appears when this is disabled is different from the one I'm now getting.
This did previously work but I haven't tried since macOS 26 is released. Is there something new I need to be doing to my Xcode project settings in order for this to be working?
Topic:
Developer Tools & Services
SubTopic:
Instruments
I am trying to perform swiftUI instrumentation on my ios app. whenever i hit the rocord button, the app launches on target device and closes with the error:
Failed to start the recording: Failed starting ktrace session.
How do i resolve this please?
Hi everyone,
I’m currently integrating AlarmKit into an app and would like to offer users the same selection of built-in iOS alarm sounds that the native Clock app provides.
So far, I haven’t found any API in AlarmKit (or elsewhere in the SDK) that exposes the system’s default alarm tones. Before implementing a custom sound library, I wanted to check:
Is there any way to access or present the iOS system alarm sounds when creating alarms with AlarmKit?
Or are developers limited to custom audio files that we provide ourselves?
If anyone has experience with AlarmKit or knows whether this is technically possible (or explicitly restricted), I’d really appreciate your insights.
Thanks!
Topic:
Developer Tools & Services
SubTopic:
Instruments
Instruments is crashing when the swiftui instrument is stopped (the session is finished) and the transfer begins from device to device:
Crashed Thread: 11 Dispatch queue: com.apple.swiftuitracingsupport.reading
Exception Type: EXC_BAD_INSTRUCTION (SIGILL)
Exception Codes: 0x0000000000000001, 0x0000000000000000
Termination Reason: Namespace SIGNAL, Code 4 Illegal instruction: 4
Terminating Process: exc handler [1633]
I've tried removing derived data, reinstalling xcode, updating xcode (I originally thought this might be the issue -- I needed to update to 26.2 from the 26 RC -- the update didn't fix crash or change the crash report), and restarting both devices.
I'm running Instruments/Xcode 26.2 on a MacBook Pro 15" (2018) running Mac OS 15.7.2 (24G325) with an iPhone 16 Pro Max running 26.2.
Hoping someone else might have seen this or could help me troubleshoot. I find the swiftui instrument be helpful and like to use it :) I can post a complete crash report as well.
This is a screenshot from the Swift Task track in Xcode.
I made these tasks with
public actor ResourceManager {
func foo() {
for observer in observers {
Task(name: "ResourceManager notify observers") {
await notification(observer)
}
}
}
}
I am confused why each of the task is showing as a separate task in the task lifetime summary. Is there a way to queue the trace in Instruments into the fact that these are indeed the same task?