Macintosh Specific

This page contains special setup instructions specific to Macintosh users.

Code signing the debugger

Starting with OSX Mavericks, Apple requires programs which attach to other programs, like debuggers, to be code signed. Since we are distributing open sourced software with no central authority, you will be required to code sign the debugger yourself, that is if you want to having debugging functionality while using Lazarus on OSX. This short guide will step you through manual the process of code signing the open source gdb debugger.
Step 1: Open up the Keychain Access application (/Applications/Utilities/Keychain Navigate via the menu to Keychain Access » Certificate Assistant » Create a Certificate...
Step 2: Enter a name for the certificate. We will name it "gdb-cert". Set the fields exactly as shown below.
Step 3: Click "Continue" until you see the screen below. Set the validity period to any number. I recommend a large one like is 999 days.
Step 4: Keep clicking "Continue" until you see this screen asking for you to specify a certificate location. Set the location to "System".
Step 5: Keep clicking "Continue" until you see this screen, then click "Done".
Step 6: Next we will set the cert to be always trusted. Right-click the new certificate and select Get Info. In the next screen under the "Trust" section, set "Code Signing" to a value of "Always Trust".
Final Step 7: Close all Keychain Access windows and exit the Keychain Access app. It is important that the Keychain Access app is closed before proceeding. Next, open a new terminal and type the following.
ps -e | grep taskgated
You should see a listing like this.
56822 ??         0:03.11 /usr/libexec/taskgated -s
60944 ttys002    0:00.00 grep --color=auto taskgated
The first number in the above output is the PID. We will use this number this to kill the taskgated daemon. Type the following substituting your taskgated PID in the line below.
sudo kill -9 56822
To finish we then code sign our debugger with the certificate we just create then restart taskgated .
codesign -s gdb-cert /opt/local/bin/ggdb
sudo launchctl load /System/Library/LaunchDaemons/
You're now done code signing the debugger. Next time you try to run a project with Lazarus you will be prompted by OSX to allow the debugger to run. Grant it access and you shouldn't be bothered again. You're done.

See also