How to setup gdb and Eclipse to debug C++ files on macOS Sierra

Using gdb debugger on macOS is no longer easy since Xcode stopped using it and replaced it with lldb. On macOS Sierra there are several steps to follow in order to make it work.

Install gdb

The easier way to install gdb is by using Homebrew: “the missing package manager for macOS”. If you don’t have it installed, open your Terminal prompt and write this command:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Once you have Homebrew installed, you can simply run:

brew install gdb

Now check gdb installation by running:

gdb --version

Take note of the version: you’ll need it later. Continua a leggere How to setup gdb and Eclipse to debug C++ files on macOS Sierra