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.

iTunes (Mac/PC) and iOS built-in Podcast app are unable to process indirect download link (+Solution)


(Updated) Added solution for Nginx


If the audio/video URL of each item contains extension information, there is no problem.

However, if the audio/video URL of each item has no information about file extension, then problem occurs. (Especially if you are using download handler instead of directly downloading file)

In latter case, built-in Podcast app only can play episodes by streaming, not from downloaded file.
(After downloading episode, you can’t play that episode unless you delete the downloaded file)

Other podcast apps (Downcast, Podcruncher, …) has no problem with this (playing episodes from downloaded files).

1. Apple fixes built-in Podcast app
(but…. when? btw, Mac/WIndows iTunes also have same problem)

2. Use direct link (, instead of for media link
(but, what if it is inevitable to use download handler link?)
(it could be inevitable to use download handler link when you store the audio/video in cloud storage like dropbox, onedrive, google drive, …)

3. If solution 2 is unavailable, use redirection script (in my case, by PHP)
( -> equivalent to, downloads episode 1 file)

the extension of handler file should be that of media file (.mp3, .m4a, …), depending on your original media type.
(For solution 3, requires registering .mp3 or .m4a as being handled by PHP handler – recommends .htaccess in Apache case)

Example of redirection script (redirection.mp3)

<?php header('Content-Type: audio/mp3'); header('Location:'); ?>

Example of .htaccess (For apache webserver; put this file with same directory of redirection script)

AddHandler application/x-httpd-php .mp3

Example of nginx.conf (For Nginx webserver; might be complex than Apache case because it requires modification of setting file)

server {
­	location /podcast_service/ { # where the redirection script exists
		location ~ .*\.mp3|.*\.m4a$ { # extensions you want to handle
			fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
			include fastcgi_params;
			fastcgi_read_timeout 180;

Compiling telegram-cli on Mac OSX 10.13 (with homebrew)


Test environment) Mac OSX 10.13 (High Sierra) with homebrew
(I prefer homebrew as it doesn’t require superuser permission, compared to macports)

The way installing required packages (step 3) and compiling package (step 4) are updated in the official page, so I reflected the changes.

1. Install homebrew (refer to if not installed

2. Clone from GitHub Repository

git clone –recursive && cd tg

3. Install required packages (bison requires to be installed in homebrew for solving problem installing libevent)

brew install bison
export PATH=”/usr/local/opt/bison/bin:$PATH”
# to use installed bison permanently
echo ‘export PATH=”/usr/local/opt/bison/bin:$PATH”‘ >> ~/.bash_profile

brew install libconfig readline lua python libevent jansson

4. Compile telegram-cli
(7.0.3_1, the version of readline, can be changed according to update; change it to match your installed version)

# edit lua-tg.c to comment line 664~666 (get_peer())

export CFLAGS=”-I/usr/local/include -I/usr/local/Cellar/readline/7.0.3_1/include -I/usr/local/Cellar/openssl/1.0.2l/include
export LDFLAGS=”-L/usr/local/lib -L/usr/local/Cellar/readline/7.0.3_1/lib -L/usr/local/Cellar/openssl/1.0.2l/lib

# before executing make, edit Makefile and remove -I/usr/local/include in CFLAGS (line 3 in my case)

# (before edit)
# CFLAGS=-I/usr/local/include -I/usr/local/Cellar/readline/7.0.3_1/include – I/usr/local/Cellar/openssl/1.0.2l/include
# (after edit)
# CFLAGS=-I/usr/local/Cellar/readline/7.0.3_1/include -I/usr/local/Cellar/openssl/1.0.2l/include


(Screenshot – end of source compile)

5. Run

bin/telegram-cli -k

(You need to config the client by entering phone number including country code and code – one-time setting)

(Screenshot – successful configuration, you can see online notification)

cf) When you see “CONFIGURE: ERROR: CANNOT RUN C COMPILED PROGRAMS.” error when trying to install packages, execute xcode-select –install in terminal to (re)install Xcode command line development tools.

Reference) (Official telegram-cli page) (solving libtool installation problem) (solving lua-tg.c compile problem)

Resolving “configure: error: cannot run C compiled programs.” error when using home-brew


You might see “configure: error: cannot run C compiled programs.” error when trying to install some package using homebrew.

Screen Shot 2015-06-12 at 11.00.07 PM

It happened to me when upgraded to a new major release of Mac OSX. (e.g. from 10.10 to 10.11)
Open terminal, execute following command, and install Xcode command line development tools.

xcode-select –install

After installation, homebrew will work as expected.

즉, xcode command line develop tool을 재설치해서 해결한다는 의미입니다.