The first step is to install the Haskell Platform, if you don't already have it. You will also need to have gtk and cairo (along with development headers) installed through your operating system. After that, it should ideally be enough to run
cabal install gtk2hs-buildtools diagrams
This will probably work under Linux/Unix but some workarounds may currently be required on Windows or Mac OS X; see below. Please edit this page to add information about any problems you encounter, workarounds you discover, etc.
1 Installing on Linux/Unix
As far as we know there are currently no issues installing diagrams on Linux/Unix systems.
2 Installing on Windows
Cairo can unfortunately be difficult to install on Windows.
Here are instructions for installing gtk2hs on Windows. They work with the exception of the issue described here, which can be circumvented by passing the --global option to 'cabal install cairo' (if you don't mind installing cairo in the global package database).
Here is a discussion about the most recent difficulties.
3 Installing on Mac OS X
- make sure you're using a 64bit haskell install (you can check this by typing maxBound :: Int in ghci and seeing if you get 9223372036854775807).
- make sure you're using homebrew, and uninstall gtk and **ALL** of its dependencies (you can do that yourself e.g. type brew list | xargs brew uninstall but note this will remove *all* homebrew packages).
- type brew update
- type brew install gtk
- type gtk-demo to check gtk installed ok.
- cabal install gtk2hs-buildtools
- cabal install gtk
- If you want to try the example in the diagrams tutorial type cabal install diagrams-cairo.
- Some users report problems with chart-gtk (which has nothing to do with diagrams) so ignore any other installation instructions which tell you to install it and run an example program called plott.
Old instructions (now superseded):
Here are instructions for getting gtk installed under OS X Lion with GHC 7.2. They should also work for 7.4.
Here is more discussion about installation under OS X Lion. See also this reddit thread.