How to Debug plugins in MacOS?

Hello :slight_smile:

I’ve been trying to write a very simple plugin which only needs to send a sync signal based on the tempo and time signature of the session.

Because that plugin is very tightly connected to a host with a complex tempo map, and play/pause, I cannot simply debug it in the PluginHost.

So far the only DAW I could get to attach to Xcode is Reaper. Anybody knows how to debug a plugin running in Ableton, Studio One, Bitwig, Logic (just to name a few)?

I have not tried on Windows - is the debugging easier there?

Thank you!

Simon

Attaching a debugger to Logic is difficult because of Apple’s SIP and sandboxing…

Sometimes with Ableton, you need to re-sign the app to make it let you attach a debugger – you can simply run this shell script with the path to the Ableton app as an argument: Lemons/resign_app_for_debugger.sh at main · benthevining/Lemons · GitHub

1 Like

Thank you benvining - I’ll try that out!
Any guess for Studio One, Bitwig, or other ones?

Basically in Xcode if I try to “attach” it then it fails, and if I put the executable in the “Run” part of the Build scheme it just says “Launch xxx done.” without launching anything.

Ok I just tried, all the DAWs say the same:

Patch entitlements (if missing)...
Add: ":com.apple.security.cs.disable-library-validation" Entry Already Exists

And when I try to attache the process in Xcode they also fail all the same way:

error: attach by pid '1226' failed -- attach failed (Not allowed to attach to process. Look in the console messages (Console.app), near the debugserver entries when the attached failed. The subsystem that denied the attach permission will likely have logged an informative message about why it was denied.)

Not sure where that “Console.app” and the “informative message” are… Any idea?

Thank you :slight_smile:
Simon

Well, the systems Console App. :smiley: It’s the central logging app of macOS where a lot of programs write their logs to – this is extremely useful. Just search for “Console” in the launchpad and you’ll find it :wink:

Regarding your actual problem, are you working on an x86_64 or ARM Mac? The answers and caveats might differ a bit for both cases.
In case of ARM, depending on the host and format you are using, the plugins might or might not run in a separate process, so in some cases attaching your debugger to the actual DAW does not really help.
In case of x86_64 I usually have no problems simply attaching a debugger to Logic. To be honest, I’m not sure if this was like that out of the box or if I had to apply the csrutil enable --without debug trick to make it work :thinking:

2 Likes

Getting same error here. I don’t see a solution found above, though. Was the problem fixed? How?