cmyr / cargo-instruments

A cargo plugin to generate Xcode Instruments trace files
MIT License
679 stars 34 forks source link

xcrun: error: unable to find utility "xctrace" #81

Closed cdstanford closed 2 years ago

cdstanford commented 2 years ago

Thank you for providing this tool! I'm getting the following error:

    Finished dev [unoptimized + debuginfo] target(s) in 0.04s
   Profiling target/debug/run_example with template 'Allocations'
      Failed instruments errored: xcrun: error: unable to find utility "xctrace", not a developer tool or in PATH

I installed through brew install cargo-instruments. Then I tried running the following command:

cargo instruments -t Allocations --bin <bin name>
cmyr commented 2 years ago

Does anything here solve this for you? https://github.com/cmyr/cargo-instruments/issues/42

cdstanford commented 2 years ago

I saw that thread before, but it doesn't seem to be the solution. People were pointing to some things in XCode settings, but either something is wrong with my installation of xcode or it isn't shipped in mac as a separate program anymore. I've noticed that xcode-select -p suggests it's installed: /Library/Developer/CommandLineTools but that there's no XCode program listed in Applications or system preferences

cdstanford commented 2 years ago

At any rate, I didn't end up getting a Rust profiler to work and I'm not sure I will have time to investigate this further on my setup, so I'll close this issue unless you want to look into it further. Thanks for responding!

cmyr commented 2 years ago

Ah yea you need to install Xcode to get the instruments app, I think the standard route is now via the Mac App Store.

rafaelbeckel commented 1 year ago

I have the same issue. Also installed via Homebrew, and I have the devtools installed.

MacOS Ventura 13.0, ARM-Based Mac M2.

 # Checking Instruments app
❯ open /Applications/Xcode.app/Contents/Applications/Instruments.app
(this command correctly opens the Instruments app)

# Checking developer tools 
❯ xcode-select -p
/Library/Developer/CommandLineTools
❯ which xcrun
/usr/bin/xcrun
❯ which xctrace
/usr/bin/xctrace

# Trying to run it like in the README
❯ cargo instruments -t Allocations
    Finished dev [unoptimized + debuginfo] target(s) in 0.10s
    Profiling target/debug/myapp with template 'Allocations'
      Failed instruments errored: xcrun: error: unable to find utility "xctrace", not a developer tool or in PATH
corneliusroemer commented 1 year ago

I had xcode-beta installed - apparently that also doesn't work. Need to install xcode itself, not the beta.

Good way to install is using xcodes

bswinnerton commented 1 year ago

I was able to get this working by installing xcode and then running:

sudo xcode-select -s /Applications/Xcode.app/Contents/Developer