Everywhere that GHC/Haskell Platform installs
Asked Answered
M

4

26

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:
??

Mistassini answered 30/7, 2011 at 16:32 Comment(3)
What OS are you running?Moore
I don't know anything about OSX, but this is going to be highly dependent on the platform and how you installed it. For example, if I install HP through the package manager on Ubuntu, I can use the package manager to remove it again. On a manual install like the one I'm currently running, I have everything in it's own directory and would have to delete that directory to remove it.Gotthard
I'm more interested in "outer bounds": so, what directories would a person have to look in, to be sure that any direct result of installing the HP and "cabal install"ing were reversed, eg, deleted.Mistassini
G
23

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
Genous answered 9/8, 2011 at 12:37 Comment(1)
The second option, uninstall-hs, seems to now be the best answer.Libeler
G
14

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 ~.)

Graeco answered 25/9, 2011 at 2:50 Comment(0)
B
2

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.

Baugh answered 30/7, 2011 at 20:48 Comment(2)
This info's in "Edit2" above, now. Thanks.Mistassini
I totally forgot about ~/.ghc :-/ There is a per-version directory there you may also want to look at.Baugh
K
2

uninstall-hs does some of the work for you; I'm not sure how much.

Kibler answered 5/3, 2012 at 4:40 Comment(1)
I wrote uninstall-hs after developing the above script! It is as thorough, but is much more flexible and has many options.Graeco

© 2022 - 2024 — McMap. All rights reserved.