After installing GHC 6.10.1, you probably want to get cabal-install installed as quickly as possible, so you can grab all that Haskell library goodness from Hackage with the minimum of fuss. Once the Haskell Platform is available, this will be much easier, but until then we have to bootstrap cabal-install using just Cabal.

After a release I find myself doing this on multiple machines, so today I made a little script to automate it, and I thought I’d share it. Obviously it’s just a quick hack, only works with GHC 6.10.1, has no error-checking etc., but it does work on both Windows and Unix. Enjoy!

Update: Duncan Coutts pointed out to me that there’s a Windows cabal.exe binary available.

#!/bin/sh set -e for i in $TMPDIR /tmp c:/temp; do if test -d $i; then dir=$i break fi dir=$HOME done cd $dir wget http://hackage.haskell.org/packages/archive/zlib/0.5.0.0/zlib-0.5.0.0.tar.gz tar xzf zlib-0.5.0.0.tar.gz cd zlib-0.5.0.0 ghc --make Setup ./Setup configure --user ./Setup build ./Setup register --inplace --user cd $dir wget http://hackage.haskell.org/packages/archive/HTTP/3001.1.4/HTTP-3001.1.4.tar.gz tar xzf HTTP-3001.1.4.tar.gz cd HTTP-3001.1.4 ghc --make Setup ./Setup configure --user ./Setup build ./Setup register --inplace --user cd $dir wget http://hackage.haskell.org/packages/archive/cabal-install/0.6.0/cabal-install-0.6.0.tar.gz tar xzf cabal-install-0.6.0.tar.gz cd cabal-install-0.6.0 ghc --make Setup ./Setup configure --user ./Setup build # Don't need these libs any more... ghc-pkg unregister zlib-0.5.0.0 ghc-pkg unregister HTTP-3001.1.4 # Now use cabal-install to install itself and its dependencies ./dist/build/cabal/cabal update ./dist/build/cabal/cabal install cabal-install # Clean up... cd $dir rm -rf zlib-0.5.0.0* rm -rf HTTP-3001.1.4* rm -rf cabal-install-0.6.0* echo "ALL DONE!"