[an error occurred while processing this directive] Here follow installation instructions for Gtk2Hs, for both Windows and Ubuntu.

Please understand that we can provide very limited support if you are having problems with this. If you need help, chances are that someone else has had similar issues; so use the course forum for help!

Installing Gtk2Hs on Windows at home

Unfortunately the old windows installer for Gtk2Hs nolonger exists. Here are some step-by-step instructions.

1. Download the Haskell Platform installer for Windows from http://hackage.haskell.org/platform/windows.html and install it using the default settings (just keep clicking 'next.')

2. Download the latest all-in-one bundle for GTK+ from here: http://www.gtk.org/download-windows.html (that's this version 2.22 zip file at the time of writing 2010-11-29) and unpack it to C:\gtk

3. [This step - installing MinGW - might not be needed, but does not hurt!] Download MinGW, a GNU command line environment that is required to build Gtk2Hs, from here: http://sourceforge.net/projects/mingw/files_beta/Automated%20MinGW%20Installer/ and install it to C:\MinGW. Use the default settings for everything else (that is, keep clicking next after you've entered C:\MinGW as the install path.)

4. Add the GTK and MinGW binaries to your path environment variable. The simplest way is to use the command

each time you open a command window. To change the path environment variable permanently google for "windows path".

5. Create a dummy directory

Some genius must have left this hard coded path somewhere and 'cabal install' (below) can fail if you don't have it. After the compilation the dummy directory can be removed.

6. In the command shell, run the following commands, waiting for each one to finish, in sequence:

cabal update
cabal install gtk2hs-buildtools
cabal install gtk

7. Congratulations - you should now have a working Gtk2Hs install!

Installing Gtk2Hs on Ubuntu (or other Linux distribution) at home

There are two possibilities:

  • You have already installed the Haskell Platform

    If you have done that, you can install Gtk2Hs by typing the following three commands:

    cabal update
    cabal install gtk2hs-buildtools
    cabal install gtk

    This may take a little while as it is compiling everything from scratch. In some cases you might need to add the cabal bin to your path to get the last step to work:


    Alternatively there are pre-compiled versions of gtk2hs for some flavours of Linux (but sadly not Ubuntu). See gtk2hs download page for more information.

  • You have not installed the Haskell Platform

    [2010: This information is not confirmed to be up-to-date] If you do not have the Haskell Platform on your Ubuntu machine, the easiest way to install gtk2hs on an Ubuntu computer is to just install the libghc6-gtk-dev package. This can be done by searching for it in the Synaptic Package Manager, or simply typing this in the shell:

    sudo apt-get install libghc6-gtk-dev
    If you install gtk2hs in this way, you will have to give the flag -package gtk when you run ghci or ghc:
    ghc -package gtk --make MyProgram