Erwin Harahap

do Now or Never

How to install NS-2 on Mac

Posted by Erwin on December 25, 2011

Mac OS X is originally from UNIX, so it must support NS2 well. We only need to install xcode for develop library. And then modify the configure file in each directories of tcl otcl tctcl nam and so on, adding the corresponding xcode library path…  Here is the procedure: ^^:

Before  the procedure, you have to check the usability of X11 on your mac OS, because the nam application need it.

1. Downlaod xCode and install…

goto directory: /Developer/SDKs/MacOSX10.4u.sdk/usr/X11R6/lib and you can see lots of files…

then it is sure you already have x develop library

2. Down ns2, and extract…

3. Modify the file “configure” in each directories in tcl, tctcl, otcl, nam, and so on :

find “ xlibdirs ”

and put “ /Developer/SDKs/MacOSX10.4u.sdk/usr/X11R6/lib ” after it

find “ xincdirs ”

and put “ /Developer/SDKs/MacOSX10.4u.sdk/usr/X11R6/include ” after it

4. After modifying all related configure files, you can successfully build ns2 now by input “./install”

5. Set up environment variables:

5.1 input “ echo $SHELL ” and you can see if it is “bash“, which means Bourne Shell. (os X after 10.3 is using Bourne Shell by default)

5.2 modify .profile or .bash_profile at Users/”your name”, add the related variables like this:



    export NS_HOME=/Users/weicai/ns-allinone-2.30
    export PATH=$NS_HOME/tcl8.4.13/unix:$NS_HOME/tk8.4.13/unix:$NS_HOME/bin:$PATH
    export LD_LIBRARY_PATH=$NS_HOME/tcl8.4.13/unix:$NS_HOME/tk8.4.13/unix:$NS_HOME/otcl-1.12:$NS_HOME/lib:$LD_LIBRARY_PATH
    export TCL_LIBRARY=$NS_HOME/tcl8.4.13/library


5.3 input “ source .profile “, you can run ns2 well now!~~~ ^^

One Response to “How to install NS-2 on Mac”

  1. dikky said

    mas bisa dipostingkan ulang pakai bahasa indonesia?
    saya kurang paham maklum newbie

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: