Running TCL Programs on Windows 10

Christina Preethi Nelapudi
3 min readNov 30, 2020

Using Ubuntu Terminal and Xming.

Step 1: Enable developer mode on your system
To do this, go to settings-> Update & Security -> For Developers -> Developer Mode.

Step 2 : Install Ubuntu Terminal
You can install Ubuntu Terminal from Microsoft store. Ubuntu 20.04 is recommended.

If you encounter this error, make sure your Windows Subsystem for Linux is enabled. To check this, you can search “Turn Windows Features on or off” in the Windows search box.

After enabling this feature, a dialog box appears asking for restarting of your system. Do restart your system.

Step 3: Download and Install Xming
You can download Xming from . After completion of download, open the file and follow the wizard to complete installation.

Step 4: Open Ubuntu Terminal
Once the installation of Xming is completed, open the Ubuntu terminal that has been downloaded earlier. Since this is the first time, you are asked to enter name and password. Sometimes while installing ns2, you might get an error “Unable to Locate package ns2”. To avoid this use “sudo apt-get update” then use “sudo apt-get install ns2” command to install ns2. Next we need to install nam, to do so use the command “sudo apt-get install nam” .
With this installation is completed.

Step 5: Launch Xming server
This can done by opening XLaunch. A display settings wizard appears. Follow the wizard according to your need. At last, if you wish to save configuration you can do so my clicking on “save configuration” and finally “Finish”.
You need to launch Xming server every time you need to run your tcl programs.

After successfully launching your Xming Server, you will have to give the “export DISPLAY=:0.0” command in your Ubuntu Terminal else when you run your .tcl file your nam console and nam.out might not open while your ubuntu terminal would be showing “nam:”

Step 6: How to Run a .tcl file?
After saving your file with .tcl extension, use “ns filename.tcl” this will give you the output and also open the nam console along with nam.out where the animation for your program is simulated. Here you may encounter a problem:

Problem : If you have encountered a problem saying “When configured, ns found the right version of tclsh in /usr/bin/tclsh8.6 but it doesn’t seem to be there anymore, so ns will fall back on running the first tclsh in your path. The wrong version of tclsh may break the test suites. Reconfigure and rebuild ns if this is a problem.” Then do install tclsh by giving the command “sudo apt install tclsh” .
Now you would be able to successfully run your .tcl programs.

Hope this helped you guys!