Installing GF on Windows

Inari Listenmaa

0. Prerequisites

If you want to just download latest GF executable for Windows -- quick start, no source code, you can skip to section 2a.

If you want to get the latest versions from the GF repository, read on. While GF itself doesn't change that often (and every major release is also updated in the Windows binary package), the resource grammar libraries do, constantly -- bug fixing, new constructions implemented for smaller languages, dictionary entries, etc. So it does make sense to be able to get the latest developer code from the darcs or git repository; everyone has a read access. Also with the GF sources you get some examples and exercises used in the GF tutorial.

First thing you need for your Windows machine is a Unix-like compatibility layer, so that you can compile and build open source applications with GNU style building tools. Install MinGW and MSYS. (I have no experience on Cygwin, try it if you like.)

After installing MinGW and MSYS, you need to add the binaries to your path. To see how to set the path in Windows, see section 3 in this guide, or another guide, e.g. For instance, if you've installed MSYS in C:\msys , you need to add the following line to your Path variable.


1. Get Haskell Platform

Go to and download the installer. Follow the wizard.

Download Haskell Platform

Completed the installation of Haskell PlatformInstaller asking if you want to install GLUT

It might ask if you want GLUT (a graphics library). With GF it doesn't matter, you can choose yes or no.

2. Install GF

a) Download and unpack Windows binary package

Go to the page and choose the Windows package, a zip file named gf-<VERSION>

The Windows package is installed by just unpacking it anywhere. Everything works already, you can import files in the same directory, or in another directory if you specify the path. To make life easier, you'll still need to add the libraries to your path, in order to write just import LangEng.gfo instead of a full path like import C:\Users\myName\mySrcFolder\GF\lib\alltenses\LangEng.gfo every time. See section 3 for that.

b) Install from Hackage

After installing Haskell Platform, you have command-line tools that access Hackage, a collection of Haskell programs, and cabal, a program that installs them. The installation of Haskell Platform adds the programs automatically in your path.

Type cabal install gf on your command prompt. It puts the GF binary in the directory

    C:\Users\YOUR NAME\AppData\Roaming\cabal\bin
and the libraries in the directory
    C:\Users\YOUR NAME\AppData\Roaming\cabal\gf-<VERSION>\lib\alltenses
Add those locations to your PATH and GF_LIB_PATH environment variables, explained in section 3.

c) Download and compile the latest developer code

First you need to install the version control program darcs. This is easy with the tools you have gotten with Haskell Platform. Type the following commands:

    cabal update
    cabal install darcs
After installing darcs, go to the directory where you want to put the source code and do the following commands:

    darcs get --lazy GF
    cd GF
    cabal install

(GF source code is also mirrored in Github, see If you prefer git, just get the git repository instead of the darcs one, then go to the main directory and type cabal install.)

Compilation going on

If you get an error message of type

<built-in>:0:4: lexical error (UTF-8 decoding error)

you need to write first set lang=C in your command line. Then run cabal install again.

Then just wait for the code to compile.

3. Add GF to your PATH and libraries to GF_LIB_PATH

1. Image of Windows desktop, how to find Properties 2. Image of Windows desktop, Advanced System Settings 3. System Properties window

  1. From the Start menu, right-click Computer and click Properties.
  2. Click Advanced system settings link in the left column, choose middle tab Advanced and click Environment Variables button.
  3. In the Environment Variables window, choose the Path variable and click the Edit... button.

Add the following line to your Path, separated by ; from other locations.

    C:\Users\YOUR NAME\AppData\Roaming\cabal\bin

Create a new environment variable from the New... button. Name will be GF_LIB_PATH, and value will be the following line.

    C:\Users\YOUR NAME\AppData\Roaming\cabal\gf-3.5\lib\alltenses

Now you can to use GF from command line.

Possible problems

Contradictory dependencies (while installing)
Do you have the right version of GHC? If you just downloaded Haskell Platform, it should be the latest. But if you had an old version, or otherwise a separately compiled GHC, that might be the reason.
a) Get the latest version of Haskell Platform
b) Get only GHC, compile it somewhere, and specify it with parameter --with-compiler="C:\path\to\compiler"

curl.h not found (while installing)
You can download the curl library from There is a wizard to help determine which version you need to download for your version.

UTF-8 decoding error while compiling (while installing)
For the error message
    <built-in>:0:4: lexical error (UTF-8 decoding error)
write set lang=C in the command prompt and try cabal install again.

Invalid characters (while using GF)
First, a warning: Windows can be still very difficult with encodings.
Some solutions:
  1. Check your font. If you are using raster fonts, they can't display all characters. Right click your command prompt, go to Properties and Font tab, and choose Lucida or Consolas.
  2. Check your code page. Type chcp in your command prompt to see your active code page. You can change it to Latin 1 by typing chcp 1252, Latin 2 by typing chcp 852, etc. -- see list of code pages. In principle you can change it to UTF-8 by typing chcp 65001, but there are problems with GF, it might not work.
    • You can change the code page also when you are running the GF shell. To give any system command without leaving GF, just write a ! before the command. ! chcp shows you the code page and ! chcp XXXX changes it.
  3. Change your display language for non-unicode programs. Especially if you're working on a specific language; if you only need to work with Japanese or Russian or Turkish, but not all of them. Go to Control Panel, choose Clock, Language and Region, then Region and Language, and the Administrative tab. As shown in the image below, choose the language of your choice from the dropdown menu. This changes the default locale for non-unicode applications. If you choose Russian, you're still getting invalid character error with Japanese. For more info, see e.g.

Out of memory when linking (while using GF)
This is not a Windows specific problem, it happens with some bigger .gfo files. You can start GF giving it a little more memory. For 100 MB, start GF by typing gf +RTS -K100M -RTS in the command prompt.

Libraries not found (while using GF)
When you try to import e.g. LangIta.gfo, it says that
None of these files exists:
Look at the second line prior to the filename (C:\...\alltenses\). Is it really the path where you have your libraries? If not, go change (or create) your GF_LIB_PATH environment variable, see instructions at section 3.
Check also that GF_LIB_PATH is a system variable (lower box) instead of a user variable (upper box).

Something else
Ask by email: join the gf-dev mailing list and search for your problem/send your question
Ask on IRC: join the GF IRC channel #gf in freenode. If you don't want to join a channel, you can ask me. My nick is inariksit at freenode and Meru at IRCnet.