Cocoa in the Shell

Debug a Preference Pane with Xcode 4

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.

Tags: ,