Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install gdb on MacOS terminal Sierra

Tags:

macos

gdb

I searched online about how to install gdb on macOS Sierra 10.12.2 but failed on the methods I could find. Then I figure out the following way which is easy and works fine on my machine. hope it may help you too:)

like image 444
aFactoria Avatar asked Jan 31 '17 19:01

aFactoria


People also ask

How do I get GDB on Mac terminal?

As with GCC, the easiest way to install GDB is through Homebrew. In a Terminal window, run the command brew install gdb , and wait for it to complete. (As usual, it may ask for your password.) Now, we need to code-sign the GDB executable, so it will be allowed to control other processes, as necessary for a debugger.

Can you use GDB on Mac?

I just installed it (gdb 8.0) following this procedure as of today, it works on Mac OS High Sierra 10.13. 2 (17C88). For the latest version "brew install gdb" is fine. However, the steps above will allow you to install older versions which is handy.

Where is GDB path Mac?

If you have installed gdb as explained before (using Homebrew), the path should be: /usr/local/Cellar/gdb/version/bin/gdb (replace version with the actual version of your gdb installation, e.g. /usr/local/Cellar/gdb/8.3/bin/gdb).


2 Answers

  1. download the most recent GDB from https://www.sourceware.org/gdb/download/

  2. expand the gdb-7.12.1.tar.xz file: tar xopf gdb-7.12.1.tar.xz

  3. cd gdb-7.12.1 in terminal to open the gdb folder

  4. then follow the instructions in the README file in the gdb folder, or simply follow the following steps:

  5. ./configure, wait for the terminal

  6. make and wait again (which can take some time)

  7. sudo make install

Now gdb is installed at /usr/local/bin/

like image 142
aFactoria Avatar answered Sep 24 '22 05:09

aFactoria


Note that you might want to try/use LLDB (lldb) instead. This is now the default (don't know about 10.12, but on 10.13 it is installed, when you install the Xcode utilities). It even comes with a nice curses GUI, but otherwise a shell very similar to GDB.

like image 23
Albert Avatar answered Sep 23 '22 05:09

Albert