How to install ebe on OS X

Not Needed as of ebe Version 3.2.1

I have left this discussion here to possibly assist anyone trying to perform a similar task under OS X. Hopefully no one needs this.

Coping with System Integrity Protection

The Mac OS X System Integrity Protection software is designed to protect your computer by preventing some things like writing to system files and running a debugger. (It doesn't interfere with lldb when installed as part of XCode, but it does prevent gdb from working.) To change the settings for SIP requires booting in Recovery Mode, using a terminal window there to issue a csrutil command. This command will not work in normal more since it would modify part of the operating system files. Use the link below to see more about booting to Recovery Mode and issuing the csrutil command

Using Recovery Mode to Enable Debugging

Install Xcode (optional)

Technically you will probably only need the Xcode command line tools and the ebe universal install script will use the xcode-select command to install the command line tools. When the script runs xcode-select it will exit and you will need to run it again after the xcode-select window finishes.

If for some reason you need to install the command line tools outside the ebe install script or if you want to install the Xcode application check out:

https://developer.apple.com/downloads

Install MacPorts (optional)

MacPorts is a set of open source software which can be installed using the MacPorts "port" command after it is installed. From my experience it was a lot slower than Homebrew but worked just as well.

Follow the installation instructions at http://www.macports.org It discusses Xcode and MacPorts.

You will need to download the OS X macports pkg file and double click on it to initiate the installation.

Creating a Keychain Certificate for gdb

For security reasons OS X does not trust programs which control other programs and this is exactly what gdb needs to do. It is necessary to create a certificate using the Keychain Access program to create a certificate and use the codesign command to sign the certificate after gdb is installed. The ebe install program can do the codesign command for you, but you will need to create the certificate first.

Creating a Certificate with Keychain Access

Using the Install Script

There is an install script at http://sourceforge.net/projects/qtebe/files/Installer named install_ebe.sh. This script will do the rest of the installation, but it would not be easy to install Xcode and MacPorts from a script. Download the script and do:

sh install_ebe.sh

I believe that there have been problems with qt5 and perhaps you might wish try qt4 if the install script fails. The relevant line number is about 245.

Install gdb 8.0.1

Homebrew (at this time) installs version 8.1 of gdb which does not work. After you set a break point and issue the run command it gets an untrapped signal which is probably the trap signal which is supposed to be used to return control to gdb for debugging. You can use:

gdb --version

to see if your version is 8.1 and perhaps this problem is solved. Otherwise use these 2 commands to remove version 8.1 and install 8.0.1:

brew unlink gdb
brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/9ec9fb27a33698fc7636afce5c1c16787e9ce3f3/Formula/gdb.rb

gdb: do not run sub-processes using /bin/sh

By default gdb will run sub-processes using a shell (probably /bin/sh) which is disallowed under OS X by the System Integrity Protection software. Create a file in your home directory named ".gdbinit" with the following command for gdb to execute every time it starts:

set startup-with-shell off

Completing the installation with individual commands

It may be useful to know the steps involved in order to cope with problems, but hopefully your original installation will go well. In the future you could skip the xcode-select, port, codesign, and killall commands.

Install Xcode command line tools

xcode-select --install   # probably says it doesn't exist

Install tools used by ebe

brew install git gcc astyle nomebrew/dupes/gdb nasm qt5
brew link --overwrite gdb
brew link --force qt5
ln -s /usr/local/bin/gcc-4.9 /usr/local/bin/gcc
ln -s /usr/local/bin/g++-4.9 /usr/local/bin/g++

or

sudo port install astyle git qt5-mac nasm gdb

Use codesign to tell OS X that you trust gdb

sudo codesign -s gdb-cert /usr/local/bin/gdb

or

sudo codesign -s gdb-cert /opt/local/bin/ggdb

I think MacPorts places a certificate called gdb-cert on your system, but perhaps this was from an older installation on my Mac.

If there is a problem with using the codesign command, follow the instructions given at http://ntraft.com/installing-gdb-on-os-x-mavericks or http://wiki.lazarus.freepascal.org/GDB_on_OS_X_Mavericks_and_Xcode_5

Restart taskgated

You need to find the process id of taskgated using

killall -9 taskgated

Taskgated should restart. It took about 1 minute on my computer, though it should be immediate. Check with ps.

Test gdb by itself

It might be smart to compile a C program (or C++) and try running gdb before running ebe.

gcc -g hello.c -o hello
gdb hello
break main
run
quit

gdb will either complain about untrusted software or will start running your program and stop on the first line of the program.

Get ebe and build

git clone git://git.code.sf.net/p/qtebe/code ebe
cd ebe
bash rebuild
sudo cp ebe *.qm /opt/local/bin

After the clone, it is possible to update the source using

git pull

Then you could rebuild ebe fairly quickly.