Ruben Laguna’s blog

GDB Posix_spawn Failed on Mac OS X Mountain Lion

If you can’t debug with ddd or gdb on Mac OS X Mountain Lion due to posix_spawn failed error then just run sudo gdb or sudo ddd instead.

The complete error message is

(gdb) run
Starting program: /Users/ecerulm/projects/luaqueue/test 
warning: posix_spawn failed, trying execvp, error: 2
Cannot exec /home/ecerulm/local/bin/zsh -c  exec /usr/bin/arch -arch x86_64 /Users/ecerulm/projects/luaqueue/test .

and after running it as sudo gdb the error is gone