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

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

Install gdb

The easiest 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 run:

brew install gdb

Now check gdb installation by running:

gdb --version

Take note of the version: you’ll need it later. In my case, it is 8.0.1. Continue reading “How to setup gdb and Eclipse to debug C++ files on macOS Sierra”