NS3 Installation in Mac M1 | Mac M2 | Mac M3

Опубликовано: 27 Февраль 2026
на канале: Engineering Clinic – From Linux to AI
3,321
like

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

Please refer my blog for the commands to copy paste ( anklet brackets are not allowed in Youtube, hence dont use the commands given below, instead follow the below link)
https://www.nsnam.com/2024/08/ns3-ins...

Prerequisites:
ns-allinone-3.42.tar.bz2 software
Homebrew or Macports(we use homebrew here)
Xcode command line tools

Here is the installation of homebrew, open a terminal

% /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Hom...)"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
In 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.1...
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-all...

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

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
Thats it!!! Thanks for watching and subscribing to my channel....

Join this channel to get access to the perks:
   / @tspradeepkumar  

My other Channel -    / tspradeepkumar1​  
My Tech Blog - https://www.nsnam.com/
My Personal webiste - https://www.pradeepkumar.org ​
______________________________

Follow me on,
Instagram -   / tspradeepkumar  
Facebook -   / tspradeep​  
Twitter -   / tspradeepkumar​  
________________________________