Codesign gdb on OSX

Screen Shot 2016-07-06 at 16.58.50

Trying to use gdb on OSX El Capitan gave me following message.

Solution?

You need to codesign gdb with a custom certificate.

  1. Open Keychain Access
  2. In the menu, go to Certificate Assistant -> Create Certificate
  3. Choose an appropriate name like gdb-cert, set Identity Type to Self Signed Root, set Certificate Type to Codesign, and check Let me override defaults
  4. Optional: extend duration
  5. Click continue until specifying location for the certificate, choose System
  6. In System, click on gdb-cert, choose Get Info, go to Trust and set Code Signing to Always Trust
  7. Restart taskgated
    sudo kill -9 (pidof taskgated)</pre> </li>  	<li>Codesign gdb <pre class="">sudo codesign -s gdb-cert(which gdb)