Verify that the operation was successfull by running: gdb -version To install the latest version of gdb, run this command: brew install gdb In this tutorial, I'm going to use gdb 8.3.
You can either use gdb 8.0.1 or one of the latest versions, starting from 8.3. If you're using High Sierra (macOS 10.13) or later, be aware that gdb 8.1 and 8.2 are not compatible. Once you have Homebrew, you can install gdb. If you don't have it installed, open your Terminal prompt and write this command: /usr/bin/ruby -e '$(curl -fsSL )' The easiest way to install gdb is by using Homebrew: 'the missing package manager for macOS'.
Starting from Mavericks (macOS 10.9), there are several steps to follow to make it work. Using gdb debugger on macOS is no longer straightforward since Xcode stopped using it and replaced it with lldb.