I've recently formatted my Mac and when I reinstalled the command line tools, I installed the new Command Line Tools (OS X Mountain Lion) for Xcode - September 2013. I've just typed gdb in my terminal to debug one of my programs and it told me -bash: gdb: command not found. There is no gdb in these new command line tools, is there?

If it doesn't, where can I get it? How can I install it?

Is brew install gdb one choice?

  • You need to look at lldb - Xcode 5 does not include the GNU compiler or tools
    – mmmmmm
    Commented Sep 25, 2013 at 19:41
  • Why the problem? clang etc are complete C compilers etc
    – mmmmmm
    Commented Sep 25, 2013 at 19:44
  • I have to use it for my CS classes.
    – Thi G.
    Commented Sep 25, 2013 at 19:55
  • You can get gcc etc but it is complex - if doing a class I doubt the differences between compilers will matter - unless =the class provides C++ libraries but if the class says gcc then it does not aloo Macs - best to ask the teacher
    – mmmmmm
    Commented Sep 25, 2013 at 20:05
  • Also the answer will depend on what you are learning as it will matter how much you know already
    – mmmmmm
    Commented Sep 25, 2013 at 20:06

1 Answer 1


Apple switched to clang/lldb some times ago.

You can still install gdb from brew with brew install gdb as suggested. You'll probably want to install gcc with it (you'll have to specify the exact version of gcc you want, eg. brew install gcc47).

Some privileges are needed for gdb to work and you'll need to code sign the binary. See instructions given by brew.

  • In other words, you can use lldb instead of gdb.
    – vy32
    Commented Oct 9, 2013 at 21:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .