MacOS has lots of cool security features, by default the OS will only run
signed code. Great security has trade offs, tonight I was hit my MacOS
gdb needs to be signed before it will be allowed to
debug other program. It manifests like this:
$ gdb -q neat-streamer Reading symbols from neat-streamer...done. (gdb) r Starting program: /Users/jones/code/neat-streamer/neat-streamer Unable to find Mach task port for process-id 13334: (os/kern) protection failure (0x2). (please check gdb is codesigned - see taskgated(8))
lldb seems like far too much work, this needs fixed. Searching
brings up stackoverflow questions, with a pointer to this guide that
explains the entire process. In general you need to create a code signing key,
sign the gdb binary and then restart the enforcement service
The restart commands were a little harder to track down.
sudo launchctl unload /System/Library/LaunchDaemons/com.apple.taskgated.plistv sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.taskgated.plistv
There are also start and stop commands, but this didn't work for me. The
troubleshooting on the guide was of no help. I even went as far as trying a
reboot, but no luck. Maybe I will try figuring out
If anyone has any idea hows to get this working, I would love some help.