skip to Main Content

i had to reinstall my MacBook Pro. I have installed the newest macOS & Xcode version so

macOS Monterey 12.0.1 (21A559)
and
Version 13.1 (13A1030d)

I’m programming Audio plugins so to test my plugins I’m normally running a DAW (Digital Audio Workstation) in my case I’m working the most of the time with Ableton or Bitwig.

So if I start the debuging process, I get the follow error:
Could not attach to pid XXXXXX
attach failed (Not allowed to attach to process. Look in the console messages (Console.app), near the debugserver entries, when the attach failed. The subsystem that denied the attach permission will likely have logged an informative message about why it was denied.)

If I have an eye to the console.app the the following lines:

[LaunchAttach] (3277) about to task_for_pid(2930)

error: [LaunchAttach] MachTask::TaskPortForProcessID
task_for_pid(2930) failed: ::task_for_pid ( target_tport = 0x0203, pid
= 2930, &task ) => err = 0x00000005 ((os/kern) failure)

macOSTaskPolicy: (com.apple.debugserver) may not get the task control
port of (BitwigStudio) (pid: 2930): (BitwigStudio) is hardened,
(BitwigStudio) doesn’t have get-task-allow, (com.apple.debugserver) is
a declared debugger(com.apple.debugserver) is not a declared read-only
debugger

1 +0.000000 sec [0ccd/0103]: error: ::task_for_pid ( target_tport =
0x0203, pid = 2930, &task ) => err = 0x00000005 ((os/kern) failure)
err = ::task_for_pid ( target_tport = 0x0203, pid = 2930, &task ) =>
err = 0x00000005 ((os/kern) failure) (0x00000005)

I have done some research and found this:
Stackoverflow link about What does get-task-allow do

get-task-allow, when signed into an application, allows other
processes (like the debugger) to attach to your app. Distribution
profiles require that this value be turned off, while development
profiles require this value to be turned on (otherwise Xcode would
never be able to launch and attach to your app).

So there is nothing I can do to debug my programs with that software. Is that correct? 🙁

4

Answers


  1. You can debug but you have to set the "Code Signing Inject Base Entitlements" to "Yes" for debugging

    enter image description here

    And then you have to add a provisioning profile. Go to developer.apple.com then select "Certificates, IDs & Profiles" to create a provisioning profile for the bundle ID you are testing.

    Login or Signup to reply.
  2. This solved it for me on terminal

    sudo DevToolsSecurity -enable
    
    Login or Signup to reply.
  3. When you don’t have access to the original source code or don’t want to rebuild it, such as when developing plug-ins for another app (a DAW in your case), you can easily change the entitlements of the application as follows to enable debugging:

    1. Read the current entitlements as follows (replace daw.app with the actual app name):

      codesign --display --xml --entitlements daw.entitlements daw.app
      

      Note: Run this in the Terminal app. It will create a file named daw.entitlements in the current folder. Run the command only once or delete any previously created daw.entitlements; otherwise the command keeps appending to the same file.

    2. Open daw.entitlements in any text editor and insert the following text just before </dict></plist> at the end of the file:

      <key>com.apple.security.get-task-allow</key><true/>

      Note: If there’s already an entry with the same name, change its value from false to true instead of adding a new one.

    3. Apply the new entitlements as follows (replace daw.app with the actual app name):

      codesign -s - --deep --force --options=runtime --entitlements daw.entitlements daw.app
      

    This should do it. In the unlikely chance that you already have a file named daw.entitlements in the same folder, use a different file name in all steps.

    Login or Signup to reply.
  4. I tried all of these and had no luck until I figured out that I also had to disable SIP (system integrity protection) to attach to the audio server plugin I am working on.

    Hopefully this helps someone to not lose a whole day on it as I did.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search