2.2. Installing on Windows
Prev | Chapter 2. Installing GHC | Next

## 2.2. Installing on Windows

Getting the Glasgow Haskell Compiler (post 5.02) to run on Windows platforms is a snap: the Installshield does everything you need.

### 2.2.1. Installing GHC on Windows

To install GHC, use the following steps:

- Download the Installshield `setup.exe` from the GHC download page haskell.org.

- Run `setup.exe`. On Windows, all of GHC's files are installed in a single directory. If you choose ``Custom'' from the list of install options, you will be given a choice about where this directory is; otherwise it will be installed in `c:/ghc/`ghc-version``. The executable binary for GHC will be installed in the `bin/` sub-directory of the installation directory you choose.

  (If you have already installed the same version of GHC, Installshield will offer to "modify", or "remove" GHC. Choose "remove"; then run `setup.exe` a second time. This time it should offer to install.)

  When installation is complete, you should find GHCi and the GHC documentation are available in your Start menu under "Start/Programs/Glasgow Haskell Compiler".

- The final dialogue box from the install process reminds you where the GHC binary has been installed (usually `c:/ghc/`ghc-version`/bin/`. If you want to invoke GHC from a command line, add this to your PATH environment variable.

- GHC needs a directory in which to create, and later delete, temporary files. It uses the standard Windows procedure `GetTempPath()` to find a suitable directory. This procedure returns:

  - The path in environment variable TMP, if TMP is set.

  - Otherwise, the path in environment variable TEMP, if TEMP is set.

  - Otherwise, there is a per-user default which varies between versions of Windows. On NT and XP-ish versions, it might be: `c:\Documents and Settings\<username>\Local Settings\Temp`

  The main point is that if you don't do anything GHC will work fine; but if you want to control where the directory is, you can do so by setting TMP or TEMP.

- To test the fruits of your labour, try now to compile a simple Haskell program:

      bash$ cat main.hs
      module Main(main) where

      main = putStrLn "Hello, world!"
      bash$ ghc -o main main.hs
      ..
      bash$ ./main
      Hello, world!
      bash$

You do not need the Cygwin toolchain, or anything else, to install and run GHC.

An installation of GHC requires about 140M of disk space. To run GHC comfortably, your machine should have at least 64M of memory.

### 2.2.2. Moving GHC around

At the moment, GHC installs in a fixed place (`c:/ghc/ghc-x.yy`, but once it is installed, you can freely move the entire GHC tree just by copying the `ghc-x.yy` directory. (You may need to fix up the links in "Start/Programs/Glasgow Haskell Compiler" if you do this.)

It is OK to put GHC tree in a directory whose path involves spaces. However, don't do this if you use want to use GHC with the Cygwin tools, because Cygwin can get confused when this happens. We havn't quite got to the bottom of this, but so far as we know it's not a problem with GHC itself. Nevertheless, just to keep life simple we usually put GHC in a place with a space-free path.

### 2.2.3. Installing ghc-win32 FAQ

I'm having trouble with symlinks.

  Symlinks only work under Cygwin (Section 2.1.2.1, “Installing”), so binaries not linked to the Cygwin DLL, in particular those built for Mingwin, will not work with symlinks.

I'm getting “permission denied” messages from the rm or mv.

  This can have various causes: trying to rename a directory when an Explorer window is open on it tends to fail. Closing the window generally cures the problem, but sometimes its cause is more mysterious, and logging off and back on or rebooting may be the quickest cure.

Prev | Up | Next
Chapter 2. Installing GHC | Home | 2.3. The layout of installed files