Fixing GDB in Emacs on Mac OS 10.8 (Mountain Lion)
Table of Contents
Getting a new GDB
- With the update to Mountain Lion, Emacs can no longer correctly interact with gdb. The easiest way to solve this is to install a newer version of GDB.
-
First, you must install HomeBrew (https://github.com/mxcl/homebrew). HomeBrew is a package manager for OSX that installs programs from source (similar to ports on BSD). You can install HomeBrew by running
$ ruby -e "$(curl -fsSkL raw.github.com/mxcl/homebrew/go)"
-
Pay attention to what brew tells you. You may need to follow some additional instructions to get brew working. When in doubt, ask brew:
$ brew doctor
-
Install a newer gdb:
$ brew install https://raw.github.com/Homebrew/homebrew-dupes/master/gdb.rb
-
You're going to have to change your paths to make your machine prefer the newer gdb to the one that came preinstalled. Edit
/etc/paths
and make sure/usr/local/bin
is at the top of the file (if not, remove it from elsewhere and put it on the first line)
Codesigning
- Since gdb has to have more privilege than most programs to manipulate other running programs, it has to be signed.
- Follow the instructions under "Creating a Certificate" at http://sourceware.org/gdb/wiki/BuildingOnDarwin#Creating_a_certificate. Call it gdb-cert.
-
Now run:
$ codesign -s gdb-cert gdb
Restart your computer. GDB should work properly now.
Date: 2012-11-14 18:22:02 EST
HTML generated by org-mode 7.3 in emacs 24