Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save kaloprominat/6924952 to your computer and use it in GitHub Desktop.
Save kaloprominat/6924952 to your computer and use it in GitHub Desktop.
macos: xcode preference pane debug settings
Debug a Preference Pane with Xcode 4
Jun 13, 2011
Some time ago I did a post to show how to debug a Preference Pane with Xcode, but the tip was for Xcode 3, and now with Xcode 4 it has changed a bit.
But yesterday Scott Lahteine posted a comment to explain how to do it, so here is the new method for Xcode 4.
• In the product menu choose Edit Scheme...
• Go to the Run section and in the Executable field choose System Preferences.app
Now we need to edit some build settings for the debug configuration :
• Deployment Location (DEPLOYMENT_LOCATION) : Yes
• Installation Build Products Location (DSTROOT) : /
• Installation Directory (INSTALL_PATH) : $(USER_LIBRARY_DIR)/PreferencePanes
And we are done, you can again debug your pref pane with Xcode ;)
Thanks again to Scott Lahteine for the tip !
EDIT
As Justin Mecham mentioned :
If you wish to automatically load the prefPane bundle that you just built, you can add ~/Library/PreferencePanes/YourPreferencePane.prefPane as a launch argument within the scheme editor. Since it’s already installed, it will simply load that pane instead of prompting you to install it.
@KyLeggiero
Copy link

Message from debugger: cannot attach to process due to System Integrity Protection

@kaloprominat
Copy link
Author

kaloprominat commented May 10, 2017

well yeah, since preference panes are run under system process, it's not possible to attach to it while SIP is being turned on =(
need to enable SIP without debug restrictions, i guess csrutil enable --without debug

upd: only complete cstutil disable worked for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment