macOS Allocation Profiler in Instruments: `Failed to gain authorization`

Hello all,

The truth is that I am not sure if this belongs to this forum, or maybe a macOS forum... But anyway, here it goes.

I have developed a program which would like to profile. I am trying to use Instruments, which works well when running the Time Profiler. However, when trying to run the Allocation profiler I get the error Failed to gain authorization. According to THIS, this has to do with my binary "not being signed with a debugging entitlement".

I guess the question now is obvious: How can I sign something to enable this? ( I am not familiar at all with the .plist files... any good link I can read).

Also, is this something that can be done by default by Cargo?

Thanks in advance!

That same thread lists the following as steps you can take:


Create a file called debug.plist . Put the following text in the new file:

<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" ""><plist version="1.0"><dict><key></key><true/></dict></plist>

Then, sign your app (or re-sign it) with the following shell ( command:

$ codesign -s - -v -f --entitlements /path/to/debug.plist /path/to/your/executable

No, cargo doesn't have a way to run commands after building. You could use something like cargo-make though.


This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.