brew install gdb
echo "set startup-with-shell off" > ~/.gdbinit

Create cert

Open /Applications/Utilities/Keychain Access.app, create certificate:

  • name: gdb-cert
  • Identity Type to Self Signed Root
  • Certificate Type to Code Signing
  • select the Let me override defaults

then click and continue, util you choose where the certificate will be stored, choose:

  • System

and create create.

Trust and sign

in Keychain Access ,right click the gdb-cert and choose "Get info"

  • Code signing: always trust

then quit keychain access, open a terminal:

codesign -s gdb-cert /usr/local/bin/gdb