Mac 创建证书(以 创建gdb证书 为例 )

open /Applications/Utilities/Keychain Access.app/

打开 钥匙串访问

继续继续

 创建完毕。

Now that we have a certificate, we need to use it to sign GDB. First, we'll restart the taskgatedprocess to make sure it picks up the new certificate. Quit Keychain Access (you must quit Keychain Access!) and return to the Terminal for these final commands.

Find the taskgated process.

ps -e grep taskgated
 

The first number in the above output is the PID. Use this to kill the process (it will immediately restart itself). 我 kill 掉 taskgated 之后,它没有自动重启,所以建议创建完证书之后,重启下系统,然后再执行:codesign -s gdb-cert $(which gdb)

Now you can finally code sign GDB.

# Homebrew version
$ codesign -s gdb-cert $(which gdb)
  

Now you should be all set! The OS X Keychain may ask for your password the first time you attempt to debug a program, but it should work!

原文地址:https://www.cnblogs.com/SZxiaochun/p/7747989.html