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/

Answer from aFactoria on Stack Overflow
๐ŸŒ
UCI ICS
ics.uci.edu โ€บ ~pattis โ€บ common โ€บ handouts โ€บ macmingweclipse โ€บ allexperimental โ€บ mac-gdb-install.html
ICS 46: GDB Installation on Mac OS X
The problem is caused by Apple switching away from GDB, the GNU debugger, to LLDB, the LLVM debugger, in their Xcode toolchain (along with the transition from GCC to Clang). Unfortunately, Eclipse is not capable of communicating with any debugger other than GDB (yet). Here is a step-by-step guide for installing and configuring GDB.
Discussions

Does installing GDB on a mac usually take a while? or is it only me?
If I recall, the Mac even lies to you. If you type GCC, it installs CLang and then aliases it to gcc, after forcing you to agree to some ridiculous terms. More on reddit.com
๐ŸŒ r/C_Programming
40
12
April 13, 2024
segmentation fault - how to install gdb on MacBook Air m2 - Stack Overflow
I believe lldb might be available for the MacOS/M2 target, but I know nothing about installing this debugger on MacOS. ... Sign up to request clarification or add additional context in comments. ... If you really want to use gdb on mac, which is as Andrew stated, not well tested, you can use ... More on stackoverflow.com
๐ŸŒ stackoverflow.com
How do I install GDB on MacOS 10.13.3 (High Sierra) - Stack Overflow
I will soon ditch this MacBook and go to pure Linux ... so user unfriendly. 2018-12-11T02:24:02.253Z+00:00 ... a) getting the latest gdb source archive (at time of writing, ftp://sourceware.org/pub/gdb/snapshots/current/gdb-weekly-8.2.50.20190212.tar.xz ยท b) build gdb. I got errors for variable ... More on stackoverflow.com
๐ŸŒ stackoverflow.com
GCC and GDB on M1 Macs
Hey guys! I was able to build gdb from source just now and documented the steps in the gist below. Gist Hope this helps! More on reddit.com
๐ŸŒ r/mac
22
6
January 23, 2022
๐ŸŒ
GitHub
gist.github.com โ€บ mike-myers-tob โ€บ 9a6013124bad7ff074d3297db2c98247
Steps to get GDB actually working in April 2021 on macOS (Intel x86-64 only) ยท GitHub
@michaelschem im on a 2022 m2 Mac and I get the same error: % brew install gdb gdb: The x86_64 architecture is required for this software. ... Hi I am using macOS Catalina 10.15.7 I had to create the certificate in login as it was showing error while doing it in system. How do i import it to system, please explain. ... # download the script https://github.com/conda-forge/gdb-feedstock/blob/main/recipe/macos-codesign/macos-setup-codesign.sh # replace the certificate name sed -i 's/gdb-codesign/gdb-cert/g' macos-setup-codesign.sh
๐ŸŒ
GNU Project
sourceware.org โ€บ gdb โ€บ download
Download GDB
You can download the most recent official release of GDB from either Project GNU's HTTPS server, or Red Hat's sources site: ... (mirrors) As with all GNU projects, you can verify the signatures for gnu project files with the keyring file from:
๐ŸŒ
Homebrew
formulae.brew.sh โ€บ formula โ€บ gdb
gdb โ€” Homebrew Formulae
https://www.gnu.org/software/gdb/ ยท License: GPL-3.0-or-later
๐ŸŒ
MacPorts
ports.macports.org โ€บ port โ€บ gdb
Install gdb on macOS with MacPorts
To install gdb, run the following command in macOS terminal (Applications->Utilities->Terminal) ... The MacPorts Project uses a system called Trac to file tickets to report bugs and enhancement requests. Though anyone may search Trac for tickets, you must have a GitHub account in order to login ...
๐ŸŒ
Reddit
reddit.com โ€บ r/c_programming โ€บ does installing gdb on a mac usually take a while? or is it only me?
r/C_Programming on Reddit: Does installing GDB on a mac usually take a while? or is it only me?
April 13, 2024 - It takes forever for Apple Silicon users unless you install JetBrains CLion and harvest the gdb build from there. It's ridiculous it took all these years to get it. ... Don't buy mac if you want to do anything beyond browsing the web and doing some basic video editing - a big fuckin' waste of money for us, coding apes ....
Find elsewhere
๐ŸŒ
University of Maryland Department of Computer Science
cs.umd.edu โ€บ ~nelson โ€บ classes โ€บ resources โ€บ computer_systems โ€บ gcc_gdb_emacs_in_mac
gcc/gdb/emacs in a Mac
In your Mac, pen a terminal. Install Homebrew (https://brew.sh/). After the Homebrew installation has been completed you can install gcc, gdb, emacs by executing on a Mac terminal:
๐ŸŒ
GNU
gnu.org โ€บ software โ€บ gdb โ€บ gdb.html
GNU Debugger (GDB)
The latest version of GDB, version 10.2, is available for download. This is a minor corrective release over GDB 10.1, fixing the following issues: PR remote/26614 (AddressSanitizer: heap-use-after-free of extended_remote_target in remote_async_inferior_event_handler) PR gdb/26828 (SIGSEGV in follow_die_offset dwarf2/read.c:22950) PR gdb/26861 (internal-error: void target_mourn_inferior(ptid_t): Assertion `ptid == inferior_ptid' failed. OS: Mac OSX Catalina; Compiler: GCC; Language: C)
๐ŸŒ
GNU
ftp.gnu.org โ€บ gnu โ€บ gdb
Index of /gnu/gdb
Index of /gnu/gdb ยท Apache/2.4.52 (Trisquel_GNU/Linux) Server at ftp.gnu.org Port 443
๐ŸŒ
GNU
lists.gnu.org โ€บ archive โ€บ html โ€บ info-gnu โ€บ 2018-09 โ€บ msg00001.html
GDB 8.2 released!
* Improved flexibility for loading symbol files. * The 'info proc' command nows works on running processes on FreeBSD systems as well as core files created on FreeBSD systems. * A new --enable-codesign=CERT configure option to automatically codesign GDB after build (useful on MacOS X).
๐ŸŒ
GNU Project
sourceware.org โ€บ gdb
GDB: The GNU Project Debugger
Those programs might be executing on the same machine as GDB (native), on another machine (remote), or on a simulator. GDB can run on most popular UNIX and Microsoft Windows variants, as well as on macOS. GDB supports the following languages (in alphabetical order): ... Version 16.3 of GDB, the GNU Debugger, is now available for download.