Skip to content

Setting up WSL Environment on Windows

nhmall edited this page May 28, 2026 · 3 revisions

Overview

The Windows Subsystem for Linux (WSL) environment allows you to setup a Linux build environment on Windows. What follows are the instructions on how to install WSL and then use it to build the linux binaries and the Guildebook.pdf.

Installing WSL2

Follow the Microsoft provided installation guide for installing WSL. The instructions that follow assume you have installed Ubuntu 25.04 LTS distro.

Running WSL2 for the first time

After installing the distro, you will want to update and install various packaged needed by the build.

From within the WSL2 environment, run the following commands:

sudo apt update
sudo apt upgrade
sudo apt install git
sudo apt install git-gui
sudo apt install make
sudo apt install gcc
sudo apt-get install libncurses5-dev
sudo apt-get install bison flex
sudo apt install gdb
sudo apt install groff
sudo apt install texlive-latex-base

Cloning source and building

You now have a proper Linux build environment and can build NetHack for Linux. Run the following commands to build:

git clone https://github.com/NetHack/NetHack.git
cd NetHack/sys/unix
sh setup.sh hints/linux
cd ../..
make all
make install

This will have installed the game to ~/nh/install/games. The game can be launched running:

cd ~/nh/install/games
./nethack

Building Guidebook

To build Guidebook.pdf run the following command within the NetHack/doc directory:

pdflatex Guidebook.tex

To build the Guidebook.txt run the following command within the NetHack/doc directory:

make Guidebook.txt

Copying files to Windows

Your windows file system drives are mounted at /mnt within the WSL environment allowing you to copy to/from your Windows file system. For example, to copy Guidebook.pdf to c:/temp for viewing within Windows you can run:

cp Guidebook.pdf /mnt/c/temp/Guidebook.pdf

Clone this wiki locally