Apply the following modifications to the file ns-allinone-2.34/install: (add what’s in red and in green*)
* the lines in green are, possibly, only necessary to Mac OS X 10.6 (aka Snow Leopard). With Mac OS X 10.5 (aka Leopard), the red lines should be enough.
Modification 1
echo "============================================================" echo "* Build OTcl-$OTCLVER" echo "============================================================" cd ./otcl-$OTCLVER blame='Please check http://www.isi.edu/nsnam/ns/ns-problems.html for common problems and bug fixes.' if [ "${test_cygwin}" = "true" ]; then ./configure --x-libraries=/usr/X11R6/lib --x-includes=/usr/X11R6/include || die "otcl-$OTCLVER configuration failed! Exiting ..."; else ./configure --x-libraries=/usr/X11R6/lib --x-includes=/usr/X11R6/include CFLAGS="-framework CoreFoundation" || die "otcl-$OTCLVER configuration failed! Exiting ..."; fi if make then echo "otcl-$OTCLVER has been installed successfully." else echo "otcl-$OTCLVER make failed! Exiting ..." echo "See http://www.isi.edu/nsnam/ns/ns-problems.html for problems" exit fi cd ..
Modification 2
echo "============================================================" echo "* Build Tclcl-$TCLCLVER" echo "============================================================" cd ./tclcl-$TCLCLVER if [ "${test_cygwin}" = "true" ]; then ./configure --x-libraries=/usr/X11R6/lib --x-includes=/usr/X11R6/include || die "tclcl-$TCLCLVER configuration failed! Exiting ..."; else ./configure --x-libraries=/usr/X11R6/lib --x-includes=/usr/X11R6/include --with-otcl=../otcl-$OTCLVER || die "tclcl-$TCLCLVER configuration failed! Exiting ..." fi if make then echo "tclcl-$TCLCLVER has been installed successfully." else echo "tclcl-$TCLCLVER make failed! Exiting ..." echo "See http://www.isi.edu/nsnam/ns/ns-problems.html for problems" exit fi cd ../
Modification 3
echo "============================================================" echo "* Build ns-$NSVER" echo "============================================================" cd ./ns-$NSVER if [ -f Makefile ] ; then make distclean fi if [ "${test_cygwin}" = "true" ]; then ./configure --x-libraries=/usr/X11R6/lib --x-includes=/usr/X11R6/include || die "Ns configuration failed! Exiting ..."; else ./configure --x-libraries=/usr/X11R6/lib --x-includes=/usr/X11R6/include LIBS="-framework CoreFoundation" --with-otcl=../otcl-$OTCLVER --with-tclcl=../tclcl-$TCLCLVER || die "Ns configuration failed! Exiting ..."; fi if make then echo " Ns has been installed successfully." else echo "Ns make failed!" echo "See http://www.isi.edu/nsnam/ns/ns-problems.html for problems" exit fi cd ../
Modification 4
echo "============================================================" echo "* Build nam-$NAMVER" echo "============================================================" ln -s otcl-$OTCLVER otcl ln -s tclcl-$TCLCLVER tclcl cd ./nam-$NAMVER # XXX temporary OS X hack if [ "${test_darwin}" = "true" ]; then ln -s /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation libcorefoundation.dylib fi if [ "${test_cygwin}" = "true" ]; then ./configure --x-libraries=/usr/X11R6/lib --x-includes=/usr/X11R6/include --with-tclcl=$CUR_PATH/tclcl-$TCLCLVER || die "Nam configuration failed! Exiting ..."; else ./configure --x-libraries=/usr/X11R6/lib --x-includes=/usr/X11R6/include V_LIBS="-framework CoreFoundation" --with-otcl=../otcl-$OTCLVER --with-tclcl=../tclcl-$TCLCLVER || die "Nam configuration failed! Exiting ..."; fi ............ cd ../
After applying those modifications, use Terminal app to go to the ns-allinone-2.3x directory and enter ./install.
Those installation procedures were tested with Max OS X 10.6, but they should work just fine with 10.5.
STILL HAVING PROBLEMS DURING INSTALLATION?
1. If, even after applying the above modifications, your installation fails, proceed as follows:
Install first Xcode development tools. They come with Mac OS X 10.6 CD as an optional installation. After doing that, proceed as explained above.
2. Still failing? Check the following instruction:
In the configure files inside nam, ns, otcl and tclcl directories, look for xlibdirs and xincdirs and check if the following lines, respectively, can be found:
/Developer/SDKs/MacOSX10.4u.sdk/usr/X11R6/lib \
and
/Developer/SDKs/MacOSX10.4u.sdk/usr/X11R6/include \
In NS-2 version 2.34, those lines are present. You should carefully look for them when using other versions.
Anything to say about it? Drop a line in the comments!
Hey there, I’ve modified the script accordingly, but the error I got during installation is ‘tk8.4.18 make failed’. Do you have any idea what’s happening? Thanks!
S, what are the ns-2 OS X version you’re using, S? Any further information about the console output would be helpful!
Thanks, it works fine for ns-2.35 !!
Great! What’s your version of OS X?
I use Lion 10.7, it works.
But now I fail to build ns-2.33 on Mountain Lion 10.8, also with error when compiling tk, it seems that X11/Xlib.h could not find. I can’t find Xlib.h on my Mac, what about you?
Unfortunately, I won’t be able to test this procedure with OS X 10.8 because I have a 2008 White MacBook that is not compatible with this new release 😦
Anyway, maybe I can help you somehow… The only problem is that exactly today my MacBook power adapter died 😦 and now I’m out of battery.
When I get a new power adapter, I’ll get in touch and maybe I’ll be able to help you.
Thanks!
Any solutions for mac os x 10.8 ? I can’t install on mountain lion
Not yet, Bruno. As I said before, I have a MacBook that is not compatible with ML, therefore I can’t test ns on this new OS X version.
Thank you soooo much for this article! I almost went crazy trying to install ns2 on my Lion 10.7.5!
This finally got me to a successful installation. Thanks!
I’m glad everything went fine with your installation.
Hello again!
The ns as I said before it is working perfectly, but I’m having a rough time with the xgraph which is not opening and giving me an error.
I checked the installation log and there was an issue with the xgraph and since ‘it is an optional package’ it kept right on.
Could you help me with that?