Setting up a Compile Environment (Windows)

Before we actually start using TortoiseHg and commit stuff to the repository, we'll be setting up some things in order to be able to use the makefile. This makefile is cross platform, but you'll have to install a few tools to be able to use Unix commands on your Windows system first. Necessary tools to use the makefile are MinGW and MSYS. If you want to do some more development stuff than just compiling a grf using a makefile then you might want the MSYS DTK as well.

Ofcourse, in order to compile grfs you need GRFCodec and NFORenum as well.


Minimalist GNU for Windows is available for download from

Download it and follow the steps of the installer. For the installation directory I recommend C:\dev\MinGW. Don't install in C:\Program Files as a path with spaces in it might cause problems. If you're thinking about starting to compile OpenTTD yourself, you need to select the additional C language support (gcc-core) and C++ language support (gcc-g++) as well. Other defaults are fine and just complete the wizard to start the installation.


Minimal SYStem adds a few UNIX tools (like make, bash and grep) to your system. On Windows Vista and up you need at least version 1.0.11 which is a release candidate at the time of writing. The stable version 1.0.10 will most likely not work correctly on your Vista operating system. Downloads are available here:; you need the executable from the list.

Download it and follow the steps of the installer. For the installation directory I recommend C:\dev\msys. Again don't install in C:\Program Files as a path with spaces in it might cause problems. If the installation is successful, a command prompt window will ask where you have your MinGW installed. Provide the information to finish the installation.


The MSYS Development ToolKit is available for download from If you want to check for a newer version you can do that here: As indicated before this is not required to be able to use the makefile, but might be useful if you want to use your development environment for something else as well.


GRFCodec is the tool used to create a grf from one or more .nfo and .pcx files. A stable version is available for download from OpenTTD's compile farm:

Download a version of your liking and extract the grfcodec.exe file to C:\dev\newgrf\bin.


NFORenum is a tool that checks and reformats NFO code. Run your .nfo through it and it tells you about most of the bugs in it. Nforenum is available for download from the OpenTTD compile farm

Download Nforenum and extract nforenum.exe to C:\dev\newgrf\bin.

Adding everything to the PATH Environment Variable

By adding C:\dev\MinGW\bin, C:\dev\msys\bin and C:\dev\newgrf\bin to your system's PATH environment variable, you can access all of the tools in those directories from any other directory on your system. So for instance you can run grfcodec from your My Documents folder without the executable having to actually be in there.

  • Rightclick Computer (on the desktop or in the Start menu) and select Properties.
  • Vista: Click Advanced System Settings in the task pane at the left.
  • A dialog box appears. On the tab Advanced click Environment Variables.
  • A dialog box with two textboxes appears. In the bottom one of the two textboxes find the Path entry and select it.
  • Click the edit button below the text box. Yet another dialog box appears.
    It is important to not remove anything from the string displayed there!
  • Now at the end of that string add the full paths to the installation directories of MinGW, MSYS and GRFCodec/NFORenum, seperated by semi-colons.
    If you used the installation directories as indicated in these guides, add the following to the end of the string:
  • When you've done that, click OK three times to close all dialog windows.
  • A set of (German) screenshots of all this is available here:


Now you're all set up to actually start using Mercurial/TortoiseHg and compile grfs yourself!

Using TortoiseHg »