Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 397
amindfv Avatar asked Jul 30 '11 16:07

amindfv


People also ask

Where does Ghcup install GHC?

Installation. The following commands will download the ghcup binary into ~/. ghcup/bin (or C:\ghcup\bin on windows) and then run it to interactively install the Haskell Toolchain.

How do I download Haskell platform?

Run the command "$ sudo apt-get install haskell-platform" and press Enter. It will automatically start downloading Haskell on your system after authenticating you with the root password. After installing, you will receive a confirmation message.

How do I know if I have Haskell installed?

If you have installed the Haskell Platform, open a terminal and type ghci (the name of the executable of the GHC interpreter) at the command prompt. Alternatively, if you are on Windows, you may choose WinGHCi in the Start menu. And you are presented with a prompt. The Haskell system now attentively awaits your input.


2 Answers

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 
like image 103
pithyless Avatar answered Sep 20 '22 02:09

pithyless


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

like image 38
MtnViewMark Avatar answered Sep 19 '22 02:09

MtnViewMark