Since Apple no longer redistributes GDB NetBeans turned out to be unable to debug native applications on OS X. Fortunately there is a workaround to get it work. This instruction says how to manually install and codesign GDB on OS X.

  1. Install or build GDB
    • Install with MacPorts
      1. First install Macports from
      2. Then install GDB
        sudo port install gdb
      3. For the remainder of the tutorial, use /opt/local/bin/gdb as the GDB executable
      4. We recommend that you install gcc too
        sudo port install gcc49
    • Install with Homebrew
      1. Install Homebrew from
      2. Now install GDB from Homebrew
        brew tap homebrew/dupes
        brew install gdb
      3. For the remainder of the tutorial, use /usr/local/bin/gdb as the GDB executable
      4. We recommend that you install gcc too
        brew install gcc
    • Build
      1. Obtain the source code from
      2. Then configure and make as usual
      3. We recommend that you build an appropriate gcc too
  2. Make sure to be a member of the _developer group
    • Verifiy membership using
      id -a
    • In case you're not a member of the _developer group follow these steps:
      sudo dscl localhost
      cd /Local/Default/Groups
      append _developer GroupMembership <username>
  3. Create certificate
    • Start Keychain Access application (/Applications/Utilities/Keychain
    • Navigate via the menu to Keychain Access > Certificate Assistant > Create Certificate...
    • Choose a name (gdb-cert, for example), set Identity Type to Self Signed Root, set Certificate Type to Code Signing and select the Let me override defaults. Click several times on Continue until you get to the Specify a Location For The Certificate screen, then set Keychain to System.
    • If you can't store the certificate in the System keychain, create it in the login keychain, then export it. You can then import it into the System keychain.
    • Finally, using the contextual menu for the certificate, select Get Info, open the Trust item, and set Code Signing to Always Trust.
  4. Restart the taskgated process to make sure it picks up the new certificate.
    • Quit Keychain Access (you must quit Keychain Access!) and return to the Terminal
    • Use this to kill the process (it will immediately restart itself)
      sudo kill -9 <taskgated PID>
  5. Now you can finally code sign GDB
    codesign -f -s gdb-cert gdb
  6. The OS X Keychain may ask for your password the first time you attempt to debug a program. As NetBeans is unable to deal with it you should run GDB in the Terminal (every time after restarting your machine) and enter your password to give gdb permission to control other processes
Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo