安装:

    brew install gdb

创建系统类型的证书gdb-cert

新建一个叫做gdb-entitlement.xml的文件

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
        <key>com.apple.security.cs.debugger</key>
        <true/>
    </dict>
    </plist>

签名:

    codesign --entitlements gdb-entitlement.xml -fs gdb-cert "$(which gdb)"

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