Skip to content

Instantly share code, notes, and snippets.

@rockymadden
Last active August 29, 2015 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rockymadden/84ac02fcec1248301ea5 to your computer and use it in GitHub Desktop.
Save rockymadden/84ac02fcec1248301ea5 to your computer and use it in GitHub Desktop.
Easy OSX GHC version switching and management via ghc-dot-app: https://github.com/ghcformacosx/ghc-dot-app
export CABALPATH=$HOME/.cabal
export PATH=$PATH:$CABALPATH/bin
function switchghc() {
ln -sf "/usr/local/lib/ghc-$@.app/Contents/bin/cabal" /usr/local/bin/cabal
ln -sf "/usr/local/lib/ghc-$@.app/Contents/bin/ghc-$@" /usr/local/bin/ghc
ln -sf "/usr/local/lib/ghc-$@.app/Contents/bin/ghc-pkg-$@" /usr/local/bin/ghc-pkg
ln -sf "/usr/local/lib/ghc-$@.app/Contents/bin/ghci-$@" /usr/local/bin/ghci
ln -sf "/usr/local/lib/ghc-$@.app/Contents/bin/haddock-ghc-$@" /usr/local/bin/haddock
ln -sf "/usr/local/lib/ghc-$@.app/Contents/bin/hp2ps" /usr/local/bin/hp2ps
ln -sf "/usr/local/lib/ghc-$@.app/Contents/bin/hpc" /usr/local/bin/hpc
ln -sf "/usr/local/lib/ghc-$@.app/Contents/bin/hsc2hs" /usr/local/bin/hsc2hs
ln -sf "/usr/local/lib/ghc-$@.app/Contents/bin/runghc-$@" /usr/local/bin/runghc
ln -sf "/usr/local/lib/ghc-$@.app/Contents/bin/runhaskell" /usr/local/bin/runhaskell
printf "GHC et al changed to version $@\n"
}
#!/bin/bash
rm -rf /usr/local/lib/ghc-7.8.2.app
curl -Lo /tmp/ghc-7.8.2.zip https://github.com/etrepum/ghc-dot-app/releases/download/v7.8.2-r8/ghc-7.8.2-r8.zip
unzip -q /tmp/ghc-7.8.2.zip -d /usr/local/lib/
chmod -R 0755 /usr/local/lib/ghc-7.8.2.app
rm -rf /usr/local/lib/ghc-7.8.3.app
curl -Lo /tmp/ghc-7.8.3.zip https://github.com/etrepum/ghc-dot-app/releases/download/v7.8.3-r0/ghc-7.8.3-r0.zip
unzip -q /tmp/ghc-7.8.3.zip -d /usr/local/lib/
chmod -R 0755 /usr/local/lib/ghc-7.8.3.app
$ switchghc 7.8.3
GHC et al changed to v7.8.3
$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 7.8.3
$ switchghc 7.8.2
GHC et al changed to v7.8.2
$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 7.8.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment