MacOS – Could not determine GDB version using command: sudo /usr/local/bin/gdb –version

eclipsemacbook promacosterminal

Eclipse (Mars) version (C programming language):
Eclipse IDE for C/C++ Developers
eclipse.buildId=4.5.0.I20150603-2000

MacOS version:
OS X Yosemite 10.10.3
HW: MacbookPro 15" (mid-2015) Retina

Problem:
Debug action causes following error message ("111" is both Project Name, and source 111.c file as well):

window title: "Problem Occurred"
Error message:
'Launching 111' has encountered a problem.
Could not determine GDB version using command: sudo /usr/local/bin/gdb –version
sudo: no tty present and no askpass program specified

As far as I understand – that GBD module was removed from MacOS X, so I probably need to install manually one.
I am newcomer in Mac, and trying installing upon different forums – I didn't succeed yet.

Probably, there maybe changes required as well in:

Debug Configurations (Run->Debug Configuration->"Debugger" tab).
Or/and as well in:
Eclipse -> Preferences -> C/C++ -> Debug -> GDB

Please answer me – who installed recently by him-/her- self. Since old (more than year from now) forums may describe other case compared to problem I need to solve.

Please provide exact steps how to manage.

Best Answer

Install with MacPorts

  1. Install Xcode and MacPorts, if not already installed.
  2. Now install the Apple GCC and GDB from MacPorts:

    $ sudo port install gdb-apple $ sudo port install apple-gcc42

Install with Homebrew

  1. Install Xcode and Homebrew, if not already installed.
  2. Now install GDB from Homebrew:

    $ brew tap homebrew/dupes $ brew install gdb

Source: http://ntraft.com/installing-gdb-on-os-x-mavericks/