Skip to content

Instantly share code, notes, and snippets.

@indradhanush
Forked from hlissner/codesign_gdb.md
Created June 21, 2017 20:29
Show Gist options
  • Save indradhanush/230233ed7b4d369f6c8e1c7bfbb81d32 to your computer and use it in GitHub Desktop.
Save indradhanush/230233ed7b4d369f6c8e1c7bfbb81d32 to your computer and use it in GitHub Desktop.
Codesign gdb on OSX

If you are getting this in gdb on OSX while trying to run a program:

Unable to find Mach task port for process-id 57573: (os/kern) failure (0x5).
 (please check gdb is codesigned - see taskgated(8))
  1. Open Keychain Access
  2. In menu, open Keychain Access > Certificate Assistant > Create a certificate
  3. Give it a name (e.g. gdbc)
  • Identity type: Self Signed Root
  • Certificate type: Code Signing
  • Check: let me override defaults
  1. Continue until "specify a location for..."
  2. Keychain = System
  3. Close. Find certificate in System keychains.
  4. Get Info
  5. Expand Trust, set Code signing to always trust
  6. killall taskgated
  7. Enable root account:
  8. Open System Preferences
  9. Go to User & Groups > Unlock
  10. Login Options > "Join" (next to Network Account Server)
  11. Click "Open Directory Utility"
  12. Go up to Edit > Enable Root User
  13. codesign -fs gdbc /usr/local/bin/gdb -- asks for root password
  14. Disable root account

Done!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment