Everywhere that GHC/Haskell Platform installs

Assume I want to completely reinstall GHC/HP. I want to (as much for superstition as anything) delete anything and everything from previous installs. What do I actually need to delete (and where)?

Edit: I'm on OSX, but I'm more curious if this information is available in general, for all systems.

Edit2: So far we have:

OSX:
/Library/Frameworks/GHC.framework/
~/.cabal/
/usr/bin/ -- symlinks

I'll add to that (based on "prefix" defined here: http://www.vex.net/~trebla/haskell/sicp.xhtml#storage):
prefix/lib/
prefix/share/
prefix/bin/
prefix/share/doc/
/usr (/local) /lib/[ghc-version]
/usr (/local) /share/doc/ghc/html/libraries/ -- documentation
/usr (/local) /share/doc/ghc/
/usr (/local) /bin
/var/lib/[ghc-version]
/etc/[ghc-version]
~/.ghc/

Edit 3:
OS X:
~/Library/Haskell

Linux:
??

Windows:
??


Had to remove Haskell Platform on OS X recently. Most are cleaned up via Uninstaller:

sudo /Library/Frameworks/GHC.framework/Versions/Current/Tools/Uninstaller

These have to be cleaned up manually:

rm -r ~/.cabal
rm -r ~/.ghc
rm -r ~/Library/Haskell

Alternatively, as documented in

/Library/Haskell/doc/start.html

there is now a custom uninstall command with options,

/Library/Haskell/bin/uninstall-hs

In general, one can document the files created by any activity (installer, ...) by bracketing the activity in a work directory with

echo >timestamp
[activity]
sudo find -x / -newer timestamp -print >snapshot.txt

If you've installed a Haskell Platform since about 2012 on OS X, just run

uninstall-hs

and carefully read what it outputs. You'll need to run it again with the options it offers you. Run

uninstall-hs --help

for more options.


Below is my original answer, which will still work, but doesn't offer as many options and is a bit "ham fisted":

Warning: This script is extreme. It will remove even your custom config files for GHC and Cabal, and executables you've built that are still in ~/Library/Haskell or ~/.cabal . Use caution; review what it is about to do; have backups; caveat scriptor!

#!/bin/bash
set -x

sudo rm -rf /Library/Frameworks/GHC.framework
sudo rm -rf /Library/Frameworks/HaskellPlatform.framework
sudo rm -rf /Library/Haskell
rm -rf ~/.cabal
rm -rf ~/.ghc
rm -rf ~/Library/Haskell
find /usr/bin /usr/local/bin -type l | 
  xargs -If sh -c '/bin/echo -n f /; readlink f' | 
  egrep '//Library/(Haskell|Frameworks/(GHC|HaskellPlatform).framework)' | 
  cut -f 1 -d ' ' > /tmp/hs-bin-links
sudo rm -f `cat /tmp/hs-bin-links`

You may want to add lines to save off and restore your config files like:

mv ~/.cabal/config /tmp/cabal-config 2>/dev/null || true
mv ~/.ghc/gchi.conf /tmp/ghci-config 2>/dev/null || true

and

mkdir ~/.cabal
mkdir ~/.ghc
cp /tmp/cabal-config ~/.cabal/config 2>/dev/null || true
cp /tmp/ghci-config ~/.ghc/gchi.conf 2>/dev/null || true

Bracket the rm lines with these. Though you may or may not want your old ~/.cabal/config if you are upgrading to newer stuff.

Note that this only deals with the current user's home directory. If you have multiple user accounts that all use Haskell, then the other accounts will need cleaning as well. (Repeat the lines involving ~ .)


I am on OSX (Lion atm). I've got GHC in /Library/Frameworks/GHC.framework/ (current and previous versions). There are also some symlinks in /usr/bin, but these will be replaced by a new install.

If you have used cabal to (locally) install packages, you also may want to clean out ~/.cabal. If you have a recent cabal, you can easily reinstall all packages for the 'new' GHC version by using cabal install world and then look for directories matching previous version of GHC you had like so:

for package in `ls ~/.cabal/lib/`; do 
   if [ ! -d ~/.cabal/lib/${package}/ghc-7.0.3 ]; then 
       echo $package; 
   else 
       echo "OK for $package"; 
   fi;
done 

These should be safe to delete.

Hope this helps you somewhat.

链接地址: http://www.djcxy.com/p/75466.html

上一篇: 如何为沙箱中的所有包设置cabal extra dirs

下一篇: GHC / Haskell平台安装的地方