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 installer does everything you need.

### 2.2.1. Installing GHC on Windows

To install GHC, use the following steps:

- Download the installer from the GHC download page.

- Run the installer. On Windows, all of GHC's files are installed in a single directory. You can override it, but by default this directory is `c:/ghc/ghc-`version``. The executable binary for GHC will be installed in the `bin/` sub-directory of the installation directory. If you want to invoke GHC from a command line, add this to your `$PATH` environment variable.

  When installation is complete, you should find GHCi and the GHC documentation are available in your Start menu under "Start/All Programs/GHC/ghc-`version`".

- 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 the environment variable TMP, if TMP is set.

  - Otherwise, the path in the 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 365M of disk space. To run GHC comfortably, your machine should have at least 64M of memory.

### 2.2.2. Moving GHC around

Once GHC is installed, you can freely move the entire GHC tree just by copying the `c:/ghc/ghc-`version`` directory. (You will need to fix up the links in "Start/All Programs/GHC/ghc-`version`" 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 haven'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