bsr
bsr

Reputation: 58732

Gdb on Mac OS X v10.7 (Lion)

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
Error: No available formula for gdb

What is the best way to do it?

When installed Xcode, it may have installed an older version. Currently,

$ which gdb
/usr/bin/gdb

$ gdb --version
GNU gdb 6.3.50-20050815 (Apple version gdb-1705) (Fri Jul  1 10:50:06 UTC 2011)
Copyright 2004 Free Software Foundation, Inc.

But I need version > 7.1

System version,

Model Name:     MacBook Air
System Version: Mac OS X 10.7.1 (11B2118)

Upvotes: 25

Views: 32523

Answers (3)

John Clements
John Clements

Reputation: 17233

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!

Upvotes: 1

Cripto
Cripto

Reputation: 3751

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.

Upvotes: 27

wkl
wkl

Reputation: 80031

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

Upvotes: 35

Related Questions