Make sure you have the xcode command line tools installed (im 90% sure this is needed, was busy trying to build the mac kernel).
xcode-select --install
Best way is to try macports. install macports https://www.macports.org/install.php
Then run:
sudo port install dtrace
I tried macports and it was broken for catalina, got it working off git though. I had to download some header files though:
- link.h
- msg.h
- dwarf.h
- elf.h
- gelf.h
- libdwarf.h
- libelf.h
I just added these to the include directory.
I also changed the include from the std library (<file.h>) to search the /usr/local/include path by replacing all e.g. <link.h> with "link.h", this repo reflects this.
Copy those files to /usr/local/include/
cp -frv include/*.h /usr/local/include/
git clone https://github.com/opensource-apple/dtrace.git
mkdir -p obj sym dst
xcodebuild install -target ctfconvert -target ctfdump -target ctfmerge \
ARCHS="x86_64" SRCROOT=$PWD OBJROOT=$PWD/obj SYMROOT=$PWD/sym \
DSTROOT=$PWD/dust
Once build succeeded you will get the following message:
INSTALL SUCCEEDED ...
You will then need to copy the binaries to /usr/local/bin
cp -frv dust/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/local/bin/* /usr/local/bin