I am a new Mac user and wonder how to install the latest version of GDB (> 7.1). I prefer to use Homebrew, but I could not find GDB listed.
brew install gdb
Homebrew does not provide gcc and the associated development tool formulas over concerns that custom/non-system compilers could break builds. Two possibilities for easiness:
This is probably the command for you:
brew install https://raw.github.com/Homebrew/homebrew-dupes/master/gdb.rb
This does not directly answer the given question, but if you're like me, what you really want is a simple way to run (something very much like) gdb.
Apple now uses Clang as its compiler, and it turns out that the clang debugger, lldb, is installed along with the other command-line tools. It appears that lldb is designed with a user interface that mimics gdb very closely.
So, the answer to your question may in fact be:
just use lldb!
Some new users may find themselves in the same situation given the Mac OS X v10.9 (Mavericks) upgrade.
Solution
Install the development tools and Xcode
Then install Homebrew
Then do:
brew install homebrew/dupes/gdb
You will notice that some applications will not allow you to use the newly added GDB.
This is because it is not signed by Apple any more.
To side step this issue: Follow this; thanks to @andre
I've had some people hit me up on IRC for more detailed instructions for this. I made a post on my site. You can find it here.