May 15, 2013

How to install NS3 on Mac OS Lion

1) Install XCode

You will find XCode in the App Store. Alternatively, you can download the most recent version of XCode from the Apple Developer Connection website ( The XCode development environment includes the gcc compiler and critical libraries required to build applications to be run in Mac OS X. Mac OS X Lion, requires XCode 4.1+.

2) Install MacPorts

2.1) Download MacPorts package installer for Lion release version 2.02 from

2.2) Click on the downloaded "pkg" file, to install MacPorts.

2.3) This will place a fully-functioning MacPorts installation on your system

3) Install Required packages for ns-3

3.1) Open a Terminal window and run each command to install the required package

3.2) Install Mercurial and Python:

>> sudo port install mercurial python26  

3.3) Install Bzr

>> sudo port install bzr

3.4) Install LibXML

>> sudo port install libxml2

3.5) Install GDB

>> sudo port install gdbm

4) Download ns3 source code

>> hg clone

>> cd ns-3-allinone

>> ./

5) Build the local repository

>> ./

6) Test the installation

>> cd ns-3-dev

>> ./