Why can't I use the GNU Debugger (GDB) programming utility on Mac as a standard user?

I can only use the GNU Debugger (GDB) when authenticated as an administrator.

When I launch GDB as a standard user, after giving the GDB command "run", a dialog requests me for a user name and password of a user in the "Developer Tools" group.

The problem is that I already am in the "Developer Tools" group, so I do not know what else to do...

Thank you!

Platform:

  • MacOS X 10.7.1
  • GCC 4.2.1
  • i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)
  • GNU gdb 6.3.50-20050815 (Apple version gdb-1705)
  • This GDB was configured as "x86_64-apple-darwin".

Solution 1:

Are you positive you are in the Developer Tools group?

Try running this command

sudo dscl . append /Groups/_developer GroupMembership <username>

That should add your user account to the group.

Solution 2:

I had the same problem, it wouldn't run, except as root/sudo, which meant I couldn't use it with eclipse, which meant I lost 5 working hours debugging the problem. Here are my results.

Firstly, gdb generated a similar error message when executed under my user account.

Unable to find Mach task port for process-id 4667: (os/kern) failure (0x5).
 (please check gdb is codesigned - see taskgated(8))

I tried code signing it by creating a certificate using Keychain, then marking the certificate as trusted for code signing. Then applying it to the executable from the command line.

codesign -s gdb-cert /usr/local/Cellar/gdb/7.6.1/bin/gdb
codesign --verify --verbose  /usr/local/Cellar/gdb/7.6.1/bin/gdb
codesign -d --verbose  /usr/local/Cellar/gdb/7.6.1/bin/gdb

That didn’t work

I tried adding my user account to the procview, procmod, and _developer groups (probably insecure, but I only deploy my code to github, and don't use the machine for personal use, so I can live with that)

sudo dscl . append /Groups/procmod GroupMembership bryanhunt

sudo dscl . append /Groups/procview GroupMembership bryanhunt

sudo dscl . append /Groups/_developer GroupMembership bryanhunt

That didn't work

Finally, I tried changing the executable's group and group sticky bit.

sudo chgrp procmod /usr/local/Cellar/gdb/7.6.1/bin/gdb
sudo chmod g+s /usr/local/Cellar/gdb/7.6.1/bin/gdb

That worked