joubin jabbari
  • home
  • blog
  • work
  • reading
  • photography
  • contact
  • resume

GDB missing on OSX 10.9

Trust me, it's not by accident that gdb is no longer being used.

My Rant

In the past, I've written about how Apple took away some tools from the Mac OS. They are not being evil. I just don't get it.

How to fix it?

  1. Install the dev tools and a package manager.

    • Go to developer.apple.com and login.

    • Choose Mac and click on "Downloads" or "View All Downloads"

    • Then download Command Line Tools for your operating system.

    • After you have installed it, you'll notice gdb is missing :)

    • Then install brew OR macports (Just install one. Not both. I recommend brew)

      • If you've used any linux distribution before, you'll know that they have command line package managers. apt-get, pacman, yum.... OSX has brew and macports.
  • Now that you have brew installed, install gdb

    • brew install homebrew/dupes/gdb
  • Sign gdb

    • You'll notice that some applications will not allow you to use the newly added gdb. That's because it is not signed by Apple and trusted by these and the Darwin Kernel.

    • First create a key in keychain that is trusted

      • Click on the upper left corner of the Apple Menu and select Keychain

      • Then select Create Certificate

        • Name: "Whatever you want to name it."

        • Identify Type: Self Signed Root

        • Certificate Type: Code Signing

        image

      • Finally, sign the damn thing

        codesign -s 'Name of Certificate' `which gdb`

Note: copy the command exactly. The 'Name of Certificate' doesn’t actually have quotes marks. But the which gdb does. But the ticks surrounding the which commandis the same key that shares button with ~. For example

codesign -s gdb `which gdb`

Alternatively, you can do which gdb which will return a path like /usr/local/bin/gdb and then you can copy and past the path into the coding command like codesign-s gdb /usr/local/bin/gdb

Ask yourself this question:

Why did Apple remove GDB? Because, lldb is better and will eventually replace GDB.

Should you use it?

  • If you have to, go for it but I recommend starting your transition to lldb as it will continue to grow far beyond gdb.

  • If eclipse or some other tool is making you use it because they only use gdb. This is why I had to look into this in the first place.

March 10 2014

Joubin Jabbari | Github | Twitter