I\'m under osx 10.8.4 and have installed gdb 7.5.1 with homebrew (motivation get a new gdb with new features such as --with-python etc... )
Long story short when I
I upgraded to gdb 8.3 and was not able to make things working.
This helped me:
codesign --entitlements gdb.xml -fs gdb-cert /usr/local/bin/gdb
Where content of gdb.xml is:
com.apple.security.cs.allow-jit
com.apple.security.cs.allow-unsigned-executable-memory
com.apple.security.cs.allow-dyld-environment-variables
com.apple.security.cs.disable-library-validation
com.apple.security.cs.disable-executable-page-protection
com.apple.security.cs.debugger
com.apple.security.get-task-allow
I found this solution here: https://timnash.co.uk/getting-gdb-to-semi-reliably-work-on-mojave-macos/
Note: Without the entitlement I was able to run gdb only with sudo.