traviscross / mtr

Official repository for mtr, a network diagnostic tool
http://www.bitwizard.nl/mtr/
GNU General Public License v2.0
2.7k stars 341 forks source link

Building & Compiling on macOS Sierra #183

Open ziggyke opened 7 years ago

ziggyke commented 7 years ago

I've noticed that there are additional steps needed to make it work on macOS Sierra and wanted to share this with you.

Steps what to do for building & compiling on macOS Sierra version: 10.12.2 (16C67)

  1. Install Xcode trough the App Store
  2. Launch Xcode, agree the terms and let it install the missing components
  3. Open Terminal
  4. Define variables via Terminal, it doesn't matter in what folder you're present
    export build=~/devtools #or any folder you'd like to build everything in
    export ACLOCAL_OPTS="-I /usr/local/share/aclocal/" #this is the folder where pkg.m4 is located, needed for building mtr because default isn't found
    export PATH=$PATH:$build/autotools-bin/bin #needed for autoconf to be found by other compilers everywhere in the Terminal
    export PATH=$PATH:$build/autotools-bin/sbin #needed to make mtr to work everywhere in the Terminal
  5. Start with building & Compiling via terminal, it doesn't matter in what folder you're present
    
    mkdir -p $build

cd $build curl -OL http://ftpmirror.gnu.org/autoconf/autoconf-2.69.tar.gz tar xzf autoconf-2.69.tar.gz cd autoconf-2.69 ./configure --prefix=$build/autotools-bin make make install

cd $build curl -OL http://ftpmirror.gnu.org/automake/automake-1.15.tar.gz tar xzf automake-1.15.tar.gz cd automake-1.15 ./configure --prefix=$build/autotools-bin make make install

cd $build curl -OL http://ftpmirror.gnu.org/libtool/libtool-2.4.6.tar.gz tar xzf libtool-2.4.6.tar.gz cd libtool-2.4.6 ./configure --prefix=$build/autotools-bin make make install

cd $build curl -OL http://ftp.gnu.org/gnu/m4/m4-1.4.18.tar.gz tar xzf m4-1.4.18.tar.gz cd m4-1.4.18 ./configure --prefix=$build/autotools-bin make make install

cd $build curl -OL https://github.com/traviscross/mtr/archive/master.zip unzip master.zip cd mtr-master ./bootstrap.sh ./configure --prefix=$build/autotools-bin make make install


6. Start using and enjoying the mtr or mtr-packet anywhere in the terminal
matt-kimball commented 7 years ago

If we are providing detailed instructions for installing prerequisites, perhaps we should suggest using homebrew to install the the autotools? It does make things easier than individually downloading packages from gnu.org.

I didn't have to do the above to build mtr, but this is probably because 'brew' has long since installed autotools on my Macbook to build some other package.

ziggyke commented 7 years ago

maybe that is correct, but that leaves me tied to homebrew/brew instead of knowing what is being installed where and in what folder. If something screws up than I can easily revert back to the previous state...

This was the most straightforward guide I could accomplish, off course I found many other solutions in different places. But wanted to share this, so that not other people with the same interest have to look all over the internet for the correct answer.