I had a bit of an journey yesterday getting gdb
, (an interactive debugger for gcc
) compiling and working in Sublime Text 3 (via the SublimeGDB package), so I thought I should document the issues I ran into & what finally worked, for others and perhaps my future self.
First things to do, is you could download the sublime text in these link. After install the sublime text, you can now create a html file don’t forget to save first before running in a browser. Here is how to setup your running environment for chro. Sublime Alehouse is a culinary establishment intent on creating the ultimate customer experience. From the moment you walk through the door, you will smell the waft of fresh bread coming from our in-house bakery, see the central bar with 56 taps and 2 casks of craft beer and small lot wines, and hear the buzz of customers exalting over their heavenly food and beverage choices.
Make your command short by introducing a new alias named 'sublime' and use it. Open bashprofile: nano /.bashprofile b. Copy this line to create the alias and save and restart terminal. Alias sublime='open -a /Applications/Sublime Text.app' c. Usage: apple.txt will open with sublime text (provide file path if necessary) sublime apple.txt.
When I first installed the SublimeGDB package and tried to run it, nothing seemed to happen, so I went to View -> Show Console
and saw a the directory is invalid
error. I googled a bit and ended up following the instructions here to get it to work: instead of setting the workingdir
to ${folder:${file}}
or ${folder:${project_path:your_executable_name}}
, as the default settings seem to suggest -- or even ~/...
, I ended up using an absolute path ('/Users/my-user-name/...
) and specifying these other settings in my *.sublime-project
file:
Images For Sublime C Mac
Sublime Text 3 C++ Mac
Then I got an error about it not being able to find gdb
(command not found
, I think), which indicated the gdb
wasn't installed on my system. I tried installing it via Homebrew (brew install gdb
), which appeared to work, but when I tried to use it, it failed with this error:
This *.dylib
library wasn't on my machine; I'm guessing (and this is just speculation; I don't actually know how Homebrew works) that Homebrew installed a pre-compiled version of gdb
which depended on a library that existed on the machine it was compiled with, but did not exist on my machine.
I was able to address this by compiling gdb
myself -- first, I downloaded & tried to compile the latest version (8.1) from http://ftp.gnu.org/gnu/gdb/. There were 150 warnings and 1 error, which was buried in the warnings & I couldn't find by searching the console because the warnings had the word 'error' in them too. Then I downloaded & compiled the previous version (7.12), via running ./configure
and make
and, in spite of a ton of warnings, it compiled! I installed it (I think via sudo make install
) and then followed the instructions here to generate a CodeSigning certificate on macOS, to configure the OS to always trust the cert and to sign the newly-installed gdb
executable with the cert.
So, after over an hour of wrestling, I was finally able to run the gdb
debugger from Sublime. It ran to the breakpoint and then I was able to use the step
and next
commands to walk through the code. It took about 60 seconds to find & fix the bug in my game (a clone of the classic action/block-pushing game, Beast).
I had a bit of an journey yesterday getting gdb
, (an interactive debugger for gcc
) compiling and working in Sublime Text 3 (via the SublimeGDB package), so I thought I should document the issues I ran into & what finally worked, for others and perhaps my future self.
When I first installed the SublimeGDB package and tried to run it, nothing seemed to happen, so I went to View -> Show Console
and saw a the directory is invalid
error. I googled a bit and ended up following the instructions here to get it to work: instead of setting the workingdir
to ${folder:${file}}
or ${folder:${project_path:your_executable_name}}
, as the default settings seem to suggest -- or even ~/...
, I ended up using an absolute path ('/Users/my-user-name/...
) and specifying these other settings in my *.sublime-project
file:
Then I got an error about it not being able to find gdb
(command not found
, I think), which indicated the gdb
wasn't installed on my system. I tried installing it via Homebrew (brew install gdb
), which appeared to work, but when I tried to use it, it failed with this error:
Mac Sublime C++
This *.dylib
library wasn't on my machine; I'm guessing (and this is just speculation; I don't actually know how Homebrew works) that Homebrew installed a pre-compiled version of gdb
which depended on a library that existed on the machine it was compiled with, but did not exist on my machine.
Download Sublime Text 4.4107 For Mac - Filehippo.com
I was able to address this by compiling gdb
myself -- first, I downloaded & tried to compile the latest version (8.1) from http://ftp.gnu.org/gnu/gdb/. There were 150 warnings and 1 error, which was buried in the warnings & I couldn't find by searching the console because the warnings had the word 'error' in them too. Then I downloaded & compiled the previous version (7.12), via running ./configure
and make
and, in spite of a ton of warnings, it compiled! I installed it (I think via sudo make install
) and then followed the instructions here to generate a CodeSigning certificate on macOS, to configure the OS to always trust the cert and to sign the newly-installed gdb
executable with the cert.
So, after over an hour of wrestling, I was finally able to run the gdb
debugger from Sublime. It ran to the breakpoint and then I was able to use the step
and next
commands to walk through the code. It took about 60 seconds to find & fix the bug in my game (a clone of the classic action/block-pushing game, Beast).