Debugging preference panes is complicated because they are not standalone applications. Instead, they run inside the System Preferences process.
It is not possible to connect to a running preference pane in order to pause execution at Xcode breakpoints, unless System Integrity Protection (SIP) is first disabled.
Therefore the procedure for developing PostgresPrefs is as follows:
- Reboot your computer
- Enter Recovery Mode by holding down Command-R
- Click Utilities -> Terminal
- Run
csrutil enable --without debug - Reboot
- In Xcode, click
Runto execute a build and automatically launchPostgresPrefsin System Preferences - Once
PostgresPrefsis visible, in Xcode clickDebug->Attach to Process->legacyLoader-<platform_name> - Now set breakpoints and debug as normal
- Reboot into Recovery Mode again
- In Terminal run
csrutil clear - Reboot
In Terminal, run scripts/dist.sh in the project directory. This does the following:
- Performs a release build to create
build/PostgresPrefs-x.y/PostgresPrefs.prefPane - Wraps this in
build/PostgresPrefs-x.y.dmg - Codesigns the
.dmgfile - Submits the
.dmgfile to Apple for notarization - Polls Apple's notarization service until done
- The Xcode project and the above script are configured to use the Apple account for Macca Tech Ltd.
- Anyone forking this project will need to configure their own account details in the code signing section in Xcode, and also change any hard-coded account details in
scripts/*. - Notarization requires first configuring an App-Specific Password, which can be done at https://appleid.apple.com. The user will be prompted to enter this password when running
scripts/dist.sh.