Installing LENS under Windows

Detailed instructions for installing and running LENS are found on the LENS website:

…click on the “Installing Lens” link. Lens works on UNIX and Mac OS X operating systems as well. There are a couple of slightly confusing and/or outdated parts that this handout aims to clarify. Click here to install under Mac OSX.

Step 1: Install Cygwin

The first step provide a link to the Cygwin home page. Cygwin is a UNIX emulator that runs under Windows. Click on the “Install now” link and choose to run the program setup.exe.  This will open an install interface that will ask you whether you want to install over the internet, or download the files without installing. If your internet connection is fast and reliable, I recommend installing over the internet.

Next it will ask you to choose a server to download from. Pick one near to the US: a server that ends in “.com”, such as, is usually an okay choice.

A window will pop up asking you which packages you wish to install with Cygwin. There are a lot of them. Don’t be intimidated. Here are the packages you definitely need in addition to the default choices:

Editors/xemacs (or another text editor you prefer)

Just click on these options. When a package is selected, a little box with an X will appear beside it. If it says “Skip”, it isn’t selected! If you want you can look at other fun packages that can be installed as well. For instance, Games/ctetris! When you have selected all the packages you need/want, go ahead and start the download or install process. It will take awhile to finish, so go have a coffee or other delicious beverage. Or, you could do your first reading assignment!

If you ran the installation over the internet, Cygwin is now installed. If you downloaded the file, you need to run the “setup.exe” program again, choose “install from local directory”, and choose the directory where you downloaded all those files.

Step 2: Install Lens

Once Cygwin is working, LENS installation should be straightforward, with one slight wrinkle:

  • Start Cygwin by double-clicking on the icon on your desktop.
  • Make a directory called Lens by typing: mkdir Lens
  • Go into that directory by typing: cd Lens
  • Download the Lens package by clicking on the download link in step 7
  • Here is the wrinkle: You need to move the file from wherever it landed when you downloaded it to your new Lens directory. In Windows explorer, find the file called lens-win.tar.gz and move it here:

C:\cygwin\home\[your user name]\Lens\

  • Then, back in the Cygwin console, type:

tar xvzf lens-win.tar.gz       [this extracts the software]
rm lens-win.tar.gz               [this removes the big archived file you downloaded]

If all has gone well, you now have LENS installed, though there are a couple more steps to get it running.

Step 3: Configuring Lens

My aim is to teach you to use this software without having to become a UNIX programmer. So, I am just going to give you the bare bones of what you need to do to get the software running. See here for a glossary of basic UNIX commands, which you can look at to figure out how rm, tar, ls, mv, and all these other cryptic commands actually work.  For now, type this in your Cygwin console:

xemacs .bash_profile

This brings up a window with a bunch of writing in it. The window is a text editor called Xemacs; it is very handy and powerful but I am not going to tell you anything about that right now. The file you are now editing is a set of commands that get executed automatically every time you start a Cygwin session. So, this file is a good place to put commands to configure Lens.  Move the cursor down to the bottom of the file and type the following:

export HOSTTYPE=i686
export LENSDIR=c:/cygwin/home/[your username]/Lens
export PATH=${PATH}:/cygdrive/c/cygwin/home/[your username]/Lens/Bin/

Now save the file and exit, using the pull-down menus. You should be ready to fire up the simulator—just type:


Did two windows pop up?  If so, you are all set. If not, doublecheck that you have followed the instructions accurately. If you have done so and things still aren’t working, you may need to compile LENS from the source files as discussed on the LENS home page.

Once you have LENS installed and running, you should try out the tutorial network which will give you a little bit of an idea how the simulator works. Go back to the LENS home page, click on “Example Networks” and then on “Tutorial Network.” Read through this web page and do what it says. Don’t worry if you don’t understand the computerese—just read through and get what you can out of this tutorial, and come to class next week armed with questions.