[SOLVED] Debugging works on Mac OSX using xterm.
OSX Version: 10.11 (El Capitan)
CodeBlocks Version: 13.12
Start Terminal from /Applications/Utilities.
Install homebrew
$ ruby -e "$(curl -fsSL
https://raw.githubusercontent.com/Homebrew/install/master/install)"
Install debugger
$ brew install gdb
Codesign the gdb binary and kill taskgated:
Guide:
https://sourceware.org/gdb/wiki/BuildingOnDarwin(Note: You must make sure that taskgated is killed when following the guide.
Then, you should get a pop-up when using gdb within codeblocks the first
time, asking for credentials.)
In Terminal:
$ /usr/local/bin/gdb -v (make sure it works)
(You could prepend your PATH with /usr/local/bin in your .bash_profile.
However, note that codeblocks won't see your PATH.)
Install XQuartz
Browser:
https://www.xquartz.org/(click on the .dmg, double-click after download, follow instructions)
Reboot (you could just log-out and log-in but the reboot should solve the taskgated issue, too)
First, start XQuartz from /Applications/Utilities.
In Terminal:
$ /opt/X11/bin/xterm (make sure it works)
If you get the "Xt error: Can't open display" problem, you probably didn't reboot or log out.
In CodeBlocks: Settings->Debugger
Click Default
Set Executable path: /usr/local/bin/gdb
In CodeBlocks: Settings->Environment
Set Terminal to launch console programs: /opt/X11/bin/xterm -e $SCRIPT
Ignore the warning in the xterm window (the debugger seems to work fine):
warning: GDB: Failed to set controlling terminal: Operation not permitted