Compiling / playing nethack 3.6.0 on Ubuntu or Debian

UPDATE: Instructions added for enabling the hilite_status feature to get nice coloured Hitpoint & Hunger highlighting

After a 10+ year hiatus, the NetHack DevTeam is happy to announce the release of NetHack 3.6, a combination of the old and the new.

- nethack 3.6.0 release notes

It took me a while to figure out how to actually get nethack v3.6.0 running on Ubuntu, so I’ve shared what I learned for others.

Thanks to Jochen, we can also get this compiling on Debian Jessie.

Get setup

  • Install the dependencies
    • sudo apt-get install flex bison build-essential libncurses5-dev checkinstall
  • Get the source
  • Extract the source
    • tar xpvzf nethack-360-src.tgz

Prepare the source

  • Edit include/unixconf.h
    • Change /* #define LINUX */ to #define LINUX
  • Edit sys/unix/hints/linux to be as here.
    • For Debian Jessie, change the HACKDIR=... line to be HACKDIR=$(PREFIX)/lib/games/$(GAME)dir
  • If you want to enable Status Hilite’s;
    • Edit include/config.h
    • Change /* #define STATUS_VIA_WINDOWPORT */ to #define STATUS_VIA_WINDOWPORT
    • Change /* #define STATUS_HILITES */ to #define STATUS_HILITES
  • sh ./sys/unix/setup.sh sys/unix/hints/linux (sets up the Makefiles correctly)

Build & install

  • make all
  • sudo checkinstall (will create a package and install it for you)
    • Hit y to create default docs
    • Enter nethack 3.6.0 then hit <Enter> twice when prompted
    • At the options screen, change option 12 to say nethack-common. This avoids accidentally installing any old version from your package manager.
    • Hit <Enter> to continue
    • If you see an error “Some of the files created by the installation are inside the home directory“;
    1. Hit n (it’s just a temporary file), then
    2. Hit y to continue (we do not want those files in our package).

Uninstallation

To uninstall, use your favourite package manager, or sudo dpkg -r nethack.

Play!

Now you can run the game via nethack.

Need some help getting starting with nethack? Read the v3.6.0 guidebook.

Tagged , , , ,

22 thoughts on “Compiling / playing nethack 3.6.0 on Ubuntu or Debian

  1. Matt Winner says:

    I’m getting the following error running lubuntu 14.10:

    ..sys/share/unixtty:c:41:20: fatal error: curses.h: no such file or directory
    #include

    I assumed that I needed libncurses5-dev, but for some reason I have been unable to install this package through the ordinary channels. Any tips?

    • Jess Telford says:

      14.10 has gone past its 9 month support cycle, so all the apt repositories have been moved (why they do this, I have no idea). An indicator is getting lots of 404 errors when doing an `apt-get update`.

      To fix it, run this command: http://askubuntu.com/a/710884/18693

      I’ve had to do it on my old boxes in the past too, works a treat!

      Then you can re-try the installation of libncurses.

      • Matt Winner says:

        Many thanks for putting together this guide. I am massively excited for Nethack 3.6.

        I’m currently getting from apt-get update: “could not resolve ‘us.old-releases.ubuntu.com.'”

        Any ideas? I might very well need to modernize my system, but it might be a day’s worth of work 🙂

        • Jess Telford says:

          Hmm, that’s no good. Looks like you may have had a country-specific source in there.

          Try running this command to use the general “http://old-releases.ubuntu.com/ubuntu” instead of the country-specific “http://us.old-releases.ubuntu.com/ubuntu”:

          sudo sed -i -e ‘s/us.old-releases.ubuntu.com/old-releases.ubuntu.com/g’ /etc/apt/sources.list

          Then follow it up with a:

          sudo apt-get update

          • Matt Winner says:

            Massive compiling success after I had libncurses5-dev, bison, and flex installed from the old-releases.ubuntu.com repository.

            Thanks again! You, my friend, are a damned wizard 🙂

          • Jess Telford says:

            Awesome to hear!

            … But, I like think of myself as more of a Rogue or a Barbarian 😉

  2. Matt Winner says:

    Also, it might be useful to remind folks that might need to “sh ./setup.sh hints/linux”

    • Jess Telford says:

      Just doing `./setup.sh` should correctly execute it as a shell script. But it can’t hurt to be explicit in my instructions. I’ve updated it to have `sh ./setup.sh`, thanks!

      • Matt Winner says:

        You shell must be more awesome than mine is. I have to actually type the “sh” command 🙂

        • Jess Telford says:

          It might be that the setup.sh didn’t keep the executable bit set when you extracted the source.

          What’s the output of:

          ls -hAl sys/unix/setup.sh

          Mine is:

          -rwxrwxr-x 1 jess jess 1.1K Jun 12 2015 sys/unix/setup.sh

          • Matt Winner says:

            It says, with sudo:

            “ls: cannot access sys/unix/setup.sh: No such file or directory”

            Typing the “sh” doesn’t waste too many minutes out of my day, so I don’t mind 🙂

  3. Jochen says:

    Thanks for this. To make it work with Debian Jessie I had to change https://gist.github.com/jesstelford/67eceb7a7fa08405f6b7#file-makefile-L14

    to:

    HACKDIR=$(PREFIX)/lib/games/$(GAME)dir

  4. BeeHynes says:

    Hey, when I use make all I get
    make: *** No rule to make target `all’. Stop.

    Any insight into what the issue may be ? Running Ubuntu 14.04

  5. Beuz says:

    Thank you very much, it worked perfectly. I actually installed linux distro just to play this game. I hate that you can’t go fullscreen on windows console and don’t really like to play the “graphical” version. I was kind of lost, so thank you, again!

  6. IRI says:

    On Ubuntu 14.04 LTS after the installation the command “nethack” tries to launch it from /usr/bin/nethack, but actually game is placed in /usr/games/. I don’t want to spend time to find where to fix it, so I just run it with “/usr/games/nethack”. But probably this info will be helpful for unfamiliar people.

  7. Paul Meyer says:

    Solved issue:

    If you get “Cannot create save file” when trying to save, go to /var/games/nethack, create a save directory, and give it root ownership and full permissions:

    sudo mkdir /var/games/nethack/save
    sudo chmod 777 /var/games/nethack/save

    That worked for me.

  8. Ron says:

    Does it create nethack-x11 with tiles included?

Leave a Reply

Your email address will not be published. Required fields are marked *