Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Uninstall Haskell from Mac OS X
#!/bin/bash
# source: http://www.haskell.org/pipermail/haskell-cafe/2011-March/090170.html
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
# review /tmp/hs-links
sudo rm `cat /tmp/hs-bin-links`
@kenfehling
Copy link

kenfehling commented Jul 20, 2018

Thanks for this! One small modification:

rm -rf ~/.cabal
rm -rf ~/.ghc

Right?

@olivier-text100
Copy link

olivier-text100 commented Oct 17, 2018

Or run:
$ uninstall-hs

@chanhosuh
Copy link

chanhosuh commented Mar 21, 2020

uninstall-hs is the way to go, thanks @olivier-text100

@Hughshine
Copy link

Hughshine commented Jun 23, 2020

Maybe someone has also installed Haskell with ghcup... which makes rm -rf ~/.ghcup useful.

@gatlin
Copy link
Author

gatlin commented Jul 9, 2020

Thanks for this! One small modification:

rm -rf ~/.cabal
rm -rf ~/.ghc

Right?

Good call!

@gatlin
Copy link
Author

gatlin commented Jul 9, 2020

I haven't used a Mac for 6 years so my apologies to everyone if this isn't perfect!

@qin-yu
Copy link

qin-yu commented Sep 20, 2020

Or run:
$ uninstall-hs

Some files/folders require sudo but in sudo there is no uninstall-hs of course. Just use the full script by @gatlin to avoid even more complications.

@ahx-code
Copy link

ahx-code commented Oct 6, 2020

When I run the last command sudo rm 'cat /tmp/hs-bin-links' I have the following warning:

usage: rm [-f | -i] [-dPRrvW] file ...
       unlink file

What does it mean?

@qin-yu
Copy link

qin-yu commented Oct 6, 2020

When I run the last command sudo rm 'cat /tmp/hs-bin-links' I have the following warning:

usage: rm [-f | -i] [-dPRrvW] file ...
       unlink file

What does it mean?

I guess you are using the single quote instead of the grave accent.

@ahx-code
Copy link

ahx-code commented Oct 6, 2020

When I run the last command sudo rm 'cat /tmp/hs-bin-links' I have the following warning:

usage: rm [-f | -i] [-dPRrvW] file ...
       unlink file

What does it mean?

I guess you are using the single quote instead of the grave accent.

I used a single quote for properly displaying the statement. Even if I use the grave accent, still I have the same warning. I'm not familiar with the bash terms. I guess the warning means "No folder named hs-bin-links"?

@ilovejs
Copy link

ilovejs commented Oct 14, 2020

sudo rm -rf /usr/local/lib/HaskellCLI-8.6.4-13.14-2

@mikeschinkel
Copy link

mikeschinkel commented Jul 20, 2021

Hi @olivier-text100

Or run:
$ uninstall-hs

Where should I expect uninstall-hs to be found?

It is not in my path and looking for up I turn up nothing.

@itseramin
Copy link

itseramin commented Sep 29, 2021

What about .ghcup?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment