Installing ns-2.35 on Mountain Lion, Mavericks, Yosemite and El Capitan (OS X 10.8/10.9/10.10/10.11)


Here i will provide step by step procedure for you to install ns-2.35 on mac OS X 10.8/9/10 which i successfully installed on my mac (fully tested by me and its working)

Credits:- 


  1. Brain Adamson(for great patch) 
  2. Henrique Zelak Leite Bastos for the right help.
  3. APPLE for Mac OS X.(the best a dev. can get)

Step 1. Software Requirements (Pre-requisites).




Step 2. Choose install directory.


  • Place the downloaded ns-allione-2.35.tar.gz file in the location you want to install it. 

Step 3. Extract ns files.

  • Go to location where you have put your downloaded .tar.gz file and run 
  • tar zxvf ns-allinone-2.35.tar.gz 

Step 4.  Get into the Directory.


  • Execute  cd ns-allinone-2.35

Step 5. Download Patch.


  • Extract and put these files in ns-allinone-2.35 directory.

Step 6. Execute install command


  • Execute ./install64 (will give paths after completion. Copy them)

Step 7. Save Paths.



  • So now we save the paths returned by successful execution of install command.
  • This step is the most critical step as requires proper attention.
  • Come back to your user/home directory and run
  • touch ~/.bash_profile (if you don't have a bash_profile file in your home directory).
  • open ~/.bash_profile (opens bash_profile file in textEdit).
  • Now add paths like 
export PATH=$PATH:path1:path2:path3 (paths are separated by colon)
  • similarly add LD Library paths like 
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:path1:path2 (paths are separated by colon)
  • and add paths also for TCL Library
export TCL_LIBRARY=$TCL_LIBRARY:path
  • Save and Exit.
  • Now run source ~/.bash_profile.
  • Type nam and .... Bingo!!! if you see the nam window (installation successful !!!)
or 
  • else recheck 7th step again as most mistakes are done during this step only (i.e. saving the paths correctly).

Comments

Harshil said…
Hi Anand. Good Job dude. I have been able to install it completely and yet when I try to execute a tcl file it says "bash: ns: command not found". Can you delve deeper into this problem ? Maybe it has something to do with the PATH setting. I would be very thankful for a detailed description for PATH setting.
SalZahranii said…
when I executed ./instal, 2 errors occur. one is that the file Xos.h is not found, and the other is that the method main in the file itm.c should have return value. I tried to fix them both but the errors still there.
Amir H KArimi N said…
template struct hash;
^
10 warnings and 2 errors generated.
make: *** [mdart/mdart_adp.o] Error 1
Ns make failed!
See http://www.isi.edu/nsnam/ns/ns-problems.html for problems
bash-3.2# sudo nano /etc/paths
bash-3.2#

Hi .. this is the error which i have got after going through all you mentioned steps..
what shall i do now?
Unknown said…
When I try to install I get the following errors:

//error 1
mdart/mdart_adp.cc:108:21: error: reference to 'hash' is ambiguous
nsaddr_t dstAdd_ = hash(reqId);

//error 2
mdart/mdart_adp.cc:396:21: error: reference to 'hash' is ambiguous
nsaddr_t dstAdd_ = hash(mdart_->id_);
Unknown said…
I got the same erro "mdart/mdart_adp.cc:108:21: error: reference to 'hash' is ambiguous"
Try this:
https://github.com/aemreunal/ns-allinone-2.35-Mac-OS-10.9-install-patch

It worked by me.
Anand Kumar said…
updated the blog and thanks a lot bro....
Anand Kumar said…
updated and its working now... :-)
Anand Kumar said…
updated and its working now... :-)
Anand Kumar said…
updated and its working now... :-)
MiaToretto said…
checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in `/Users/sanjaykumar/ns-allinone-2.35/ns-2.35':
configure: error: C compiler cannot create executables
See `config.log' for more details
Ns configuration failed! Exiting ...
Please check http://www.isi.edu/nsnam/ns/ns-problems.html
for common problems and bug fixes.
harsha said…
Could you please tell me what will be the password when we give sudo ./install64 command in the terminal?
Anand Kumar said…
beta tumse na ho payega... hum bata rahein hain .... u dont know even your system password ... u deserve a world cup ... gr8
Unknown said…
Getting the same error as MiaToretto
hemang kothari said…
/Users/hemangkothari/ns-allinone-2.35/lib/tk8.5/tk.tcl: wrong # args: should be "::source fileName"
Unknown said…
This comment has been removed by the author.
Unknown said…
% nam
nam: no display name and no $DISPLAY environment variable
child process exited abnormally

Unknown said…
could you please help me?
Unknown said…
Thanks!!! I was really struggling to do this. Now I success !
Anonymous said…
Really helpful !
@ndy said…
Really works
@ndy said…
I have trying long time install in Yosemite, you really help me.
I want to ask you if I can translate your post in Spanish por my classmate, with the respective reference.
Thanks you
Anand Kumar said…
use google translate.
Dhruv Vyas said…
I've written a small script which automates each and every step mentioned over here. (Including installing paths) Here is a github link : https://github.com/dhruvvyas90/ns-install-osx Hope it helps.
It's Working, thank u dude. :-)
Unknown said…
Hi, I've tried installing ns2 on my mac os x 10.8.5. I've hit the ./install86 command and there appeared to be no tcl8.5.10, zlib, sgb, and XGraph-12.2 libraries created. Can you please show me how I can make these?

Thanks,

Nelson
Anonymous said…
thank man, you really helped me
Unknown said…
Thanks a lot! I am currently using mac os x Yosemite and this tutorial worked perfectly. Absolutely no problems. :)
Anonymous said…
Works on El Capitan as well. Thanks a lot!
Unknown said…
Thanks for saving me a lot of time, almost gave up installing ns2 until I saw this!
SAM said…
This comment has been removed by the author.
Anonymous said…
I get this error after step 7.
./install64: line 409: autoconf: command not found
checking whether to use symlinks for manpages... no
checking whether to compress the manpages... no
checking whether to add a package name suffix for the manpages... no
checking for gcc... gcc-4.4
checking for C compiler default output file name... configure: error: C compiler cannot create executables
See `config.log' for more details.
tcl8.5.10 configuration failed! Exiting ...
Anonymous said…
Update:
The error was because I did not logout/restart after installing xQuartz
Anonymous said…
Works perfectly... Nicely done.
Unknown said…
Hi Anand Kumar
When I run ./install64, I dnt get any paths. Could you please help me.
I get following:

Last login: Thu Mar 3 13:00:38 on ttys002
Rahuls-MacBook-Pro-2:~ Rahul$ /Users/Rahul/Documents/ns/ns-allinone-2.35/install64 ; exit;
============================================================
* Testing for Darwin (OS X) environment
============================================================
Darwin detected
============================================================
* Testing for Cygwin environment
============================================================
Cygwin not detected, proceeding with regular install.
============================================================
* Testing for FreeBSD environment
============================================================
FreeBSD not detected
============================================================
* Build XGraph-12.2
============================================================
/Users/Rahul/Documents/ns/ns-allinone-2.35/install64: line 270: cd: ./xgraph-12.2: No such file or directory
/Users/Rahul/Documents/ns/ns-allinone-2.35/install64: line 271: ./configure: No such file or directory
make: *** No targets specified and no makefile found. Stop.
Can not create xgraph; But xgraph is an optional package, continuing...
============================================================
* Build CWeb
============================================================
/Users/Rahul/Documents/ns/ns-allinone-2.35/install64: line 290: cd: ./cweb: No such file or directory
ns-allinone unable to install cweb for you. Please install it manually. cweb is used by sgb to create sgblibrary needed by scenario-generator. But this will not affect the use of ns as such, so continue..
============================================================
* Build Stanford GraphBase
============================================================
/Users/Rahul/Documents/ns/ns-allinone-2.35/install64: line 321: cd: ./sgb: No such file or directory
Unable to create sgb library. This library is used by gt-itm and so for scenario generators. If you already have sgblib (possible if you are on solaris,sunos or freebsd platforms) you may still be able to run gt-itm. so continuing..
============================================================
* Build GT-ITM
============================================================
sgb lib not found. gt-itm & sgb2ns could not be installed. Continuing..
============================================================
* Build zlib
============================================================
/Users/Rahul/Documents/ns/ns-allinone-2.35/install64: line 380: cd: ./zlib-1.2.3: No such file or directory
/Users/Rahul/Documents/ns/ns-allinone-2.35/install64: line 382: ./configure: No such file or directory
Zlib-1.2.3 configuration failed, but it's optional, so continuing ...
============================================================
* Build tcl8.5.10
============================================================
/Users/Rahul/Documents/ns/ns-allinone-2.35/install64: line 402: cd: ./tcl8.5.10/unix: No such file or directory
/Users/Rahul/Documents/ns/ns-allinone-2.35/install64: line 409: autoconf: command not found
/Users/Rahul/Documents/ns/ns-allinone-2.35/install64: line 410: ./configure: No such file or directory
tcl8.5.10 configuration failed! Exiting ...
Tcl is not part of the ns project. Please see www.Scriptics.com
to see if they have a fix for your platform.
logout
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.

[Process completed]

Anand Kumar said…
check step one, specially for x11 libraries
Anand Kumar said…
and also logout and login back.
Anonymous said…
Thank you for providing such great informaiton. You save me.

Popular posts from this blog

Tutorial to implement protoname in ns2.35

Installing ns-2.35 in Ubuntu 12.04, 12.10, 13.04, 13.10 and 14.04