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 –
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.