c++ - sierra high “please check gdb is codesigned - see taskgated(8)” - How to get gdb installed with homebrew code signed?
I made gdb work on OSX 10.9 without codesigning this way (described here):
Install gdb with macports. (may be you can skip it)
sudo nano /System/Library/LaunchDaemons/com.apple.taskgated.plist
change option string from
-spat line 22, col 27.
reboot the computer.
Use gdb. If you installed it with mac ports then you must use 'ggdb' command. Or made an alias in your config file:
and use 'gdb' command then.
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 run debug within a c++ Eclipse project I get :
Error in final launch sequence Failed to execute MI command: -exec-run Error message from debugger back end: Unable to find Mach task port for process-id 46234: (os/kern) failure (0x5). (please check gdb is codesigned - see taskgated(8)) Unable to find Mach task port for process-id 46234: (os/kern) failure (0x5). (please check gdb is codesigned - see taskgated(8))
I have followed various suggestions for code signing
- partly http://www.noktec.be/archives/1251 with various adjusts
So I did:
- Set up the certificate
- Sign the gdb -> codesign -s gdb-cert /usr/local/bin/gdb
When I re-run debugging in Eclipse I get same error as above "(please check gdb is codesigned - see taskgated(8))".
If I set back the gdb to the older gdb (in the gdb preferences of Eclipse) /usr/libexec/gdb/gdb-i386-apple-darwin the debugging runs as expected.
Any solutions / hints out there ?
I wonder if the global change in the highest voted answer here has some unintended consequences.
Rather than enabling the old Tiger convention, taskgated does allow signed code to run. So it might be better to just get a signed cert for gdb, similar to the answer here.
After this I was able to
sudo use gdb. If you need to use gdb w/o sudo then perhaps this link will help though, disclaimer, I haven't tried it yet because using
sudo is an ok solution for now`.
None of this worked for me and I had to go with a long run. Here is a full list of steps I've done to get it working.
- Create a certificate to sign the gdb.
Unfortunately, system certificate gave me
Unknown Error = -2,147,414,007 which is very helpful, so I had to go with a workaround.
KeyChain Assistant -> Create certificate ->
Copy/move certificate to the System keychain (enter password)
- Select certificate (
Enter in console:
set startup-with-shell off
echo "set startup-with-shell off" >> ~/. gdbinit
- Enable Root User
System Preferences ->
Users & Groups ->
Unlock it ->
Login Options ->
Network Account Server ->
Unlock it ->
Edit (menu) ->
Enable Root User
sudo killall taskgated
- Finally sign gdb
codesign -fs gdb-cert "$(which gdb)"
- Disable Root User (Step 4)
- Reboot if still does not work. (if nothing else works, most likely it works already)
PS. I end up using
lldb because it just works (tutorial)