,

ns3 installation in Mac M1

Installation of NS3 in Mac M1

Installation of ns-3.42 in Mac M1. This should work for M2 and M3 as well.

Prerequisites:

  • ns-allinone-3.42.tar.bz2 software
  • Homebrew or Macports(we use homebrew here)
  • Xcode command line tools
Find the video here for more instructions:



Here is the installation of homebrew, open a terminal

% /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"z
Give the sudo or admin password to continue

The above command will install homebrew from GitHub

Set the user profile for which the installation is to be done. (In my case my username is pradeepkumar)

% (echo; echo ‘eval “$(/opt/homebrew/bin/brew shellenv)”‘) >> /Users/pradeepkumar/.zprofile

Installing Xcode
On my machine, I have already installed Xcode, but here is the command to install

% xcode-select --install
(this might take some time if you run it for the first time.)

Installation of python3 and clang
Download python3 from the website https://www.python.org/ftp/python/3.12.4/python-3.12.4-macos11.pkg
In my machine, I have installed python as well. But check my video link here for the installation of python in Mac M1 here ====>

Now install additional packages like wget

% brew install cmake ninja gnuplot ccache

Now download the ns3 software from the website nsnam.org or else use the following command to download the software

# brew install wget

# wget https://www.nsnam.org/releases/ns-allinone-3.42.tar.bz2

# tar jxvf ns-allinone-3.42.tar.bz2
# cd ns-allinone-3.42/
# ./build.py --enable-examples --enable-tests

This installation process will take some time based on the RAM and processing power of your Mac.

After the installation, you can check and run the following commands for the successful installation of ns3 in Mac M1.

% cd ns-3.42/
% ./ns3 run hello-simulator

% ./ns3 run first

% ./ns3 run second

So ns3 was installed successfully in Mac M1. Also, NetAnim as well works fine

This is how the way it looks:
ns3
ns3

To open ns3, here is the command
Open the terminal and give the following commands,

# cd ns-allinone-3.42/ns-3.42/
# ./ns3 run first

if you want to run netanim, here is the command

# cd ns-allinone-3.42/netanim-3.108/

# ./NetAnim


2 comments:

  1. sir I'm getting permission denied when I'm trying to access

    ReplyDelete
    Replies
    1. Dont use any root login, use normal login to install

      Delete