Building NS-3 3.26 in Mac OS X 10.13 (High Sierra)


I haven’t updated the ns-3 installation guide for Mac OS X, so I updated with most recent version of Mac OS X 10.13 (High Sierra)

1. Get the source and unarchive

mkdir workspace
cd workspace
tar xjf ns-allinone-3.26.tar.bz2

2. Install required library (except goocanvas and pygoocanvas)

brew install libxml2
# if libxml2 is installed but still shows error on installing NS-3, 
# try 'brew upgrade libxml2' without quote

# install other required library (valgrind should be manually installed)
brew install gsl libgcrypt doxygen gtk cvs unrar p7zip xz cmake bzr 

brew install python python3
pip3 install meson
brew install graphviz pygtk

# install gccxml
git clone
cd gccxml
mkdir gccxml-build
cd gccxml-build
cmake ../
sudo make install
cd ../..
rm -rf gccxml

# install required python library
pip2 install pygraphviz pygccxml

# install qt4 if you want to use netanim
#, step 3
brew install cartr/qt4/qt-legacy-formula

# install mercurial if you want to use it
#, step 4
brew install mercurial

# install valgrind by source
xcode-select --install

git clone git://
cd valgrind

# Recent version is already patched to support High Sierra, so nothing to do 
sudo make install

valgrind --version # just for test
cd ..

3. Install goocanvas-0.14 (It is important to use 0.14, though more recent versions are available)

tar xvfz goocanvas-0.14.tar.gz
rm goocanvas-0.14.tar.gz

cd goocanvas-0.14
sudo make install
cd ..
rm -rf goocanvas-0.14

4. Install pygoocanvas-0.14.1 (tested with goocanvas 2.0.2 from homebrew)

tar xvfz pygoocanvas-0.14.1.tar.gz

cd pygoocanvas-0.14.1
chmod 755

patch < pygoocanvas-0.14.1-mac.patch

cd ..
rm -rf pygoocanvas-0.14.1

5. Install ns-3

cd ns-allinone-3.26
python2 ./ --enable-examples --enable-tests

6. Test whether ns-3 is installed properly

cd ns-3.26

7. Execute example file to check ns-3 is working or not

cp examples/tutorial/ scratch/
./waf --run scratch/myfirst


Appendix A)
In previous guide, the list of required library was following:

brew install wget mercurial bzr boost pkg-config gtk gsl doxygen graphviz cvs unrar p7zip xz cmake gtkmm gtkmm3 pygtk

If you have problem with installing, try installing package above.

Appendix B)
To test PyViz, see link for the instruction.

2 thoughts on “Building NS-3 3.26 in Mac OS X 10.13 (High Sierra)

  1. test

    brew install automake


    ## before proceeding, edit
    ## 1. at line 157,
    ## before: applellvm-5.1|applellvm-6.*|applellvm-7.*|applellvm-8.*)
    ## after: applellvm-5.1|applellvm-6.*|applellvm-7.*|applellvm-9.*)
    ## 2. at line 415,
    ## before: 16.*)
    ## after: 17.*)

    brew install wget

Leave a Reply

Your email address will not be published. Required fields are marked *