19

I am trying to install GDB to work with LiteIDE, on Mavericks.

After some research, I found out that GDB does not come with Xcode anymore, and that you have to install it yourself. Short of actually installing GDB from source, and self code signing (id rather not do this), I would like to use MacPorts to get this done.

I did port install gdb, which ran and succeeded as far as I know. After the install, I closed terminal and then typed gdb and I get -bash: gdb: command not found

Does anyone have a solution for this, using MacPorts???

Jameo
  • 4,507
  • 8
  • 40
  • 66

4 Answers4

33

You should use the command "ggdb" to start the MacPorts' build of gdb.

I don't know why they have renamed it, probably a transient bug/change that will be fixed somehow, I suspect they wanted to avoid a collision with the alias "gdb" launching LLDB.

Edit: Reworded the answer to avoid ambiguities as reported by @trojanfoe

xryl669
  • 3,376
  • 24
  • 47
  • Not true at all: https://trac.macports.org/browser/trunk/dports/devel/gdb/Portfile – trojanfoe Nov 13 '13 at 11:42
  • @trojanfoe: Did you even read what you posted ? From the link you gave: `post-destroot { system "chgrp procmod ${destroot}${prefix}/bin/`**ggdb**`" system "chmod g+s ${destroot}${prefix}/bin/`**ggdb**`"` – xryl669 Nov 13 '13 at 12:30
  • 1
    No, I didn't see that, however I interpreted your answer as "you need to use 'port install ggdb' to install gdb", so you need to tidy-up your answer as it's ambiguous. – trojanfoe Nov 13 '13 at 12:47
  • Thanks for the help! That did not work initially, so I reinstalled via port install gdb, and I noticed a comment at the end of the install. – Jameo Nov 13 '13 at 15:39
  • @Jameo, oh, yes, I always run port install | less not to miss such essential information, I forgot to repeat them here. – xryl669 Nov 13 '13 at 16:35
  • 1
    Ugh. This kind of nonsense is why I usually just run stuff in a Linux VM. Well, thanks. – sudo Feb 09 '17 at 22:02
2

I finally figured it out, with some help from @xryl669. His tip that you have to use the command "ggdb" in order to access this port from macports, is correct. Also, however, I missed a command that displayed after the port installed:

You will need to make sure
/System/Library/LaunchDaemons/com.apple.taskgated.plist has the '-p' option,
e.g.
        <key>ProgramArguments</key>
        <array>
                <string>/usr/libexec/taskgated</string>
                <string>-sp</string>
        </array>

To do this, type

sudo nano /System/Library/LaunchDaemons/com.apple.taskgated.plist

And then add the "p" after -s. I don't really know what this does, but after this "ggdb" command started working for me

Edit: Adding the p is recommended but simply using "ggdb" should do the trick

Jameo
  • 4,507
  • 8
  • 40
  • 66
  • Just read why this is required, and it has nothing to do with the command. This additional parameters allow gdb to actually start tracing a process, it does not prevent it to start. So this part as nothing to do with the fact that you were unable to run ggdb. – xryl669 Nov 15 '13 at 12:52
  • you're right. At work I re-installed, did that, and then it seemed like it magically worked. At home, (which I had it already installed on also) I tried the GGDB and it worked. Sorry about that, I will accept your answer – Jameo Nov 15 '13 at 14:15
0

I don't have Mavericks yet, but since Xcode 4.3, the command-line tools are optional: https://developer.apple.com/library/ios/documentation/DeveloperTools/Conceptual/WhatsNewXcode/Articles/xcode_4_3.html "The command-line tools are not bundled with Xcode 4.3 by default. Instead, they can be installed optionally using the Components tab of the Downloads preferences panel.".

I have Xcode 5.0.1 on OSX 10.8.5 and gdb is definitely there after doing the optional command-line tools install:

$ which -a gdb
/usr/bin/gdb
$ gdb --version
GNU gdb 6.3.50-20050815 (Apple version gdb-1824) (Wed Feb  6 22:51:23 UTC 2013)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin".
$ 
Digital Trauma
  • 15,475
  • 3
  • 51
  • 83
  • My question is specifically talking about Mavericks, aka 10.9 – Jameo Nov 13 '13 at 15:40
  • @Jameo - Understood. I just wanted to make sure you know that in recent versions of Xcode, the command line tools (including GDB) are optional components which must be manually installed from the Xcode preferences menu. Did you try this step? I don't think this has anything to do with OSX version. – Digital Trauma Nov 13 '13 at 15:58
  • Yeah as far as I know, you cant get it anymore. Here is the link confirming it http://stackoverflow.com/questions/19554439/gdb-missing-in-os-x-mavericks – Jameo Nov 13 '13 at 18:53
0

I spent some time and figured it out with help of great documentation. 1. Install ggdb using MacPorts: sudo port install gdb, the file will be /opt/local/bin/ggdb. 2. Follow tutorial https://www.ics.uci.edu/~pattis/common/handouts/macmingweclipse/allexperimental/mac-gdb-install.html and it works.

I spent number of days and many various tutorials, this one actually works ! Good luck.