Gdb on Mac OS X v10.7 (Lion)

后端 未结 3 1296
攒了一身酷
攒了一身酷 2020-12-05 10:18

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
         


        
相关标签:
3条回答
  • 2020-12-05 10:59

    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:

    • Use http://www.macports.org/
    • Look here https://github.com/mxcl/homebrew/wiki/Custom-GCC-and-cross-compilers

    This is probably the command for you:

    brew install https://raw.github.com/Homebrew/homebrew-dupes/master/gdb.rb
    
    0 讨论(0)
  • 2020-12-05 11:01

    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!

    0 讨论(0)
  • 2020-12-05 11:17

    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.

    0 讨论(0)
提交回复
热议问题