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 Access.app). 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, you need to restart the taskgated service. Open a new terminal and type the following.
sudo pkill taskgated
Wait a few minutes for taskgated to restart. If you type this in a terminal.
ps -e | grep taskgated
You should see a listing like this indicating that taskgated is running again.
56822 ??         0:03.11 /usr/libexec/taskgated -s
60944 ttys002    0:00.00 grep --color=auto taskgated
Once taskgated is running again code sign the debugger using this command if you installed using Homebrew.
codesign -s gdb-cert /usr/local/bin/gdb
Or code sign the debugger using this command if you installed using Macports.
codesign -s gdb-cert /opt/local/bin/ggdb
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