Instructions on how to debug Preference Pane

I'm looking for instructions on how to set up XCode to debug a Preference Pane project in XCode 8.

Replies

Debugging preferences panes is tricky because they are loaded into a system process that you can’t attach to. I’ve not tried this myself but I did investigate a similar problem with Automator, which you can read about here.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"
I was able to disable SIP completely (in 10.15 it was possible to disable only the debugging aspect of SIP) and then attach to legacyLoader. You need to set the following as the launch executable:

/System/Library/Frameworks/PreferencePanes.framework/Versions/A/XPCServices/legacyLoader.xpc/Contents/MacOS/legacyLoader

And check the box that tells it to wait for launch. When you open System Preferences and try to load your pane, the OS will launch legacyLoader.

Personally, I think Apple really dropped the ball on this as there is no way to debug them without disabling SIP and I plan to remove my app from System Preferences (where it has lived since 2007).

@DesertNomad you're a lifesaver. I've been looking for this for the past two weeks or so. The current path for the loader is a bit different (/System/Library/Frameworks/PreferencePanes.framework/Versions/Current/XPCServices/legacyLoader-x86_64.xpc/Contents/MacOS/legacyLoader-x86_64, in my case) but the general instructions stand.