ns-2 and its dependencies don't work out of the box for MacOSX. So I've spent some time making some patches to make it work under Mac OS X Panther (10.3).

The following patches require the following:

The patches:

[04-Aug-2004] Removed accidental test results from ns-2.27 patch. now 80% smaller!
[26-Jul-2004] Fixed some problems with the otcl and tclcl patches. Now versioned by -2

Changes involved:

  • Adding support to dylib in addition to .so and .a
  • Add Darwin specific linker flags
  • Fix bugs in autoconf generation for otcl and tclcl
  • Disable indep-tools in ns-2.27 because they don't compile
  • Explicitly undefine setbit() macro for queues in ns-2.27
  • Add MacOSX specific paths for Tcl and Tk frameworks for both Apple's and tcl.sf.net's distribution.
  • Add filtering of source files to get rid of dos CRLFs during source code generation in ns-2.27

Important Caveats:

  • You should make the link from /usr/lib/libtk8.4.dylib to /Library/Frameworks/Tk.framework/Tk because the packages from tcl.sourceforge.net don't seem to do this last vital step.:
    ln -s /Library/Frameworks/Tk.framework/Tk /usr/lib/libtk8.4.dylib
  • Beware of fink. Don't mix with fink otherwise you'll get unexpected results. Maybe if fink included otcl and tclcl then you could use it, otherwise, you should stick with the Apple and tcl.sf.net's versions. If you get problems with using the puts command under ns, then you have definitely fallen into this trap. Make sure you do not have /sw/bin in your PATH environment.
  • While compiling ns-2.27, it complains that /usr/local/lib/libtclcl.a is outofdate and you should run ranlib over it. I don't know why it complains about that. If someone can let me know why, please do. The workaround is that after ns-2.27 fails because it complains about that, do: ranlib /usr/local/lib/libtclcl.a and run make again.
  • When possible, pass the --with-tk-ver=8.4.6 and --with-tcl-ver=8.4.6.

Related Links:

Here are some other people who have MacOSX versions. I haven't tried their versions, but may be better than mine. Who knows? :)

Note that I can't help you with any simulation enquiries as I don't use ns-2 often. I only ported it to MacOSX as part of my work at Fraser Research.

comments and suggestions please contact Alastair Tse <acnt2@cam.ac.uk>.