Installing ns-2 on a mac is a pain!
It was easy enough on the windows 7, but it was very tough on a mac.
Steps to install ns-2.34 –
1. Make sure you have the latest Xcode.
2. Download ns-allinone-2.34 from here.
3. Extract the downloaded tar package in it to the /Users/username/ path of your mac. (You can get to know your username by executing “who” on your terminal )
4. Now go to the ns-allinone-2.34 folder and open the “install” file using a text editor.
5. Delete its contents and copy paste the file present in this link http://pastebin.com/qsJtYw9F
6. Now open a terminal and run “./install”
7. I have encountered a lot of errors here, but finally it installed successfully.(If you get stuck, leave a comment)
8. After you get “ns-allinone package has been installed successfully.” on your terminal, execute this command in the same folder
echo “PATH=/Users/username/ns-allinone-2.34/bin:$PATH” > .bashrc
9. Next goto your home directory or just execute ‘cd’ on your terminal.
10. Present here is a hidden file called ‘.profile’. Open the file “.profile” using a text editor and add these lines –
export PATH=$PATH:/Users/username/ns-allinone-2.34/bin:/Users/username/ns-allinone-2.34/tcl8.4.18/unix:/Users/username/ns-allinone-2.34/tk8.4.18/unix
export LD_LIBRARY_PATH=/Users/username/ns-allinone-2.34/otcl-1.13:/Users/username/ns-allinone-2.34/lib
export TCL_LIBRARY=/Users/username/ns-allinone-2.34/tcl8.4.18/library
11. Run “source ~/.profile” in the terminal to refresh the terminal with the added comments in the .profile file.
12. To test if its working, download example file from here.
To know the working of the code you can go here.
13.The tcl file can be run by executing “ns example1b.tcl” on your terminal.
Source –
1. http://www.isi.edu/nsnam/ns/tutorial/
2. http://old.nabble.com/Ns2-on-Mac-OS,-problem-invoking-Nam-td31055904.html
Hello,
Thanks a lot for this! I followed your instructions and I successfuly installed ns2 .but as I did not find ‘.profile’ on my home directory (or /Users/username/ ) I creted this file in /Users/username/ and wrote the lines that you propsed on it. after I execute ./validate and these tests fail:
validate overall report: some portable tests failed:
./test-all-newreno ./test-all-sack ./test-all-tcpOptions ./test-all-tcpLinux ./test-all-tcpHighspeed ./test-all-red ./test-all-cbq ./test-all-webtraf
some non-portable tests also failed:
./test-all-srm ./test-all-smac-multihop ./test-all-hier-routing ./test-all-algo-routing ./test-all-mcast ./test-all-vc ./test-all-session ./test-all-mixmode ./test-all-webcache ./test-all-mcache ./test-all-plm ./test-all-wireless-tdma
to re-run a specific test, cd tcl/test; ./test-all-TEST-NAME
Do you know what should I do?
Thanks in advance for your reply.
I am sorry but I have no idea why it is failing. I am pretty sure that .profile file is created by default on mac. I Will check on that and let you know.
Thanks for your reply, I read in the official Nsnam Troubleshooting page that “ns-2 is known to have problems with some validation tests on certain platforms due to 64-bit problems”, I have a 64-bit processor (Core i7) maybe that’s the reason why these tests fail. About ‘.profile’, I actually looked among all hidden files in home directory and even other directories but couldn’t find it, that is why I created it.
Also another question:
Do you know how can I change the “install” file of ns-2.35 if I want to install ns-2.35 instead of ns-2.34?
Thanks again,
Hi
I don’t find ‘.profile’ too. I use OS X 10.7.2.
What I do?
Tks
Create a file with the same name
Im having nothing but error messages and I’m pretty lost 😦
Can I paste it here and would you help me? I’m using Lion 10.7
thx
After several tries and times I’m getting this error:
ld: library not found for -lX11
collect2: ld returned 1 exit status
make: *** [wish] Error 1
tk8.4.18 make failed! Exiting …
For problems with Tcl/Tk see http://www.scriptics.com
Can you help me out?
Sorry, never encountered that error before.
You probably have a space character anywhere in your directory (check it via the ‘pwd’ command in the directory of the ‘install’). Probably you just need to place your file in a map so there is nowhere a space character in the directory name of ‘install’
Hey Ashwin,
Thanks for all this guide. I have one additional step to include to these.
This step is missing from your instructions and has to deal with the .profile file that we create and modify.
This step has to be executed after Step 10 and before Step 11 in your instructions.
I am calling this step 10.1.
10.1 Type source .profile in your terminal.
On performing this step, one will then be able to run the example.
Thanks,
Samudra
ah! Thanks a lot. Will add that.
[…] that installing ns2.35 on Mac OSX Lion 10.7.5 wasn’t as painful as other blogs said [Blog1][Blog2][Blog3]. [Blog1] and its comments presented useful information. So here is a quick summary of what […]
e quem esta usando 10.8 montain lion alguem sabe passar os passos
Installation Failed…:(
Any solution for this..??
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
make: *** [otclsh] Error 1
otcl-1.14 make failed! Exiting …
See http://www.isi.edu/nsnam/ns/ns-problems.html for problems
Harshs-MacBook-Pro:ns-allinone-2.35 harshbhosale$
Hi Ashwin,
Thanks a lot for your post, At step 6 (./install) I get the following error, it would be great if you can help me to fix it. Thanks a lot
* Build tcl8.4.18
============================================================
./install: line 437: autoconf: command not found
loading cache ./config.cache
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… no
checking for cc… no
configure: error: no acceptable cc found in $PATH
tcl8.4.18 configuration failed! Exiting …
Tcl is not part of the ns project. Please see http://www.Scriptics.com
to see if they have a fix for your platform.
Have you installed xcode? It says its not able to see gcc or cc. Make sure you have installed either one of them.
Thanks so much guys for your help and comments, I really appreciate it.
As the error says : Tcl is not part of the ns project. This is because you replaced the content of “install” file by the content provided in the link as mentioned in this blog and the new content has tcl8.4.18 but the folder of ns-allinone-2.34 that extracted has a tcl file with name tcl8.5.10 so what you need to do is keep the original content of the “install” file or only keep the part of tcl only 🙂 good luck
During installation this error occurred:
ist -o wish
ld: library not found for -lX11
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [wish] Error 1
tk8.4.18 make failed! Exiting …
For problems with Tcl/Tk see http://www.scriptics.com
I’d be grateful if you could help
Have you installed xcode 5 command line tools? It looks like you have not. Follow this Knowledge Base article for installation of this package: http://software.intel.com/en-us/articles/installing-intel-compilers-for-os-x-pre-requisite-xcode-command-line-tools
when I install it on my Mac then this error is coming. kindly help me in this regard.
/Users/farhanmasud/ns-allinone-2.34/tk8.4.18/unix/../generic/tk.h:81:11: fatal error:
‘X11/Xlib.h’ file not found
# include
^
1 error generated.
make: *** [tk3d.o] Error 1
tk8.4.18 make failed! Exiting …
For problems with Tcl/Tk see http://www.scriptics.com