GHC/Haskell 平台安装的任何地方

发布于 2024-11-27 06:24:59 字数 698 浏览 3 评论 0原文

假设我想完全重新安装 GHC/HP。我想(就像迷信一样)删除以前安装的所有内容。我实际上需要删除什么(以及在哪里)?

编辑:我使用的是 OSX,但我更好奇这些信息是否适用于所有系统。

Edit2:到目前为止我们有:

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

我将添加符号链接(基于此处定义的“前缀”: http://www.vex.net/~trebla/haskell/sicp.xhtml#storage):
前缀/lib/
前缀/共享/
前缀/bin/
前缀/共享/doc/
/usr (/local) /lib/[ghc-版本]
/usr (/local) /share/doc/ghc/html/libraries/ -- 文档
/usr (/local) /share/doc/ghc/
/usr (/local) /bin
/var/lib/[ghc-版本]
/etc/[ghc-版本]
~/.ghc/

编辑 3:
操作系统:
〜/库/Haskell

Linux:
??

窗口:
??

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

深居我梦 2024-12-04 06:24:59

最近不得不删除 OS X 上的 Haskell Platform。大多数都是通过卸载程序清理的:

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

这些必须手动清理:

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

或者,如文档中所述,

/Library/Haskell/doc/start.html

现在有一个带有选项的自定义卸载命令,

/Library/Haskell/bin/uninstall-hs

一般来说,可以通过以下方式记录由任何活动(安装程序,...)创建的文件:将工作目录中的活动括起来

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

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
情话墙 2024-12-04 06:24:59

如果您从 2012 年左右就在 OS X 上安装了 Haskell Platform,只需运行

uninstall-hs

并仔细阅读它的输出即可。您需要使用它提供的选项再次运行它。运行

uninstall-hs --help

以获得更多选择。


下面是我原来的答案,它仍然有效,但没有提供那么多选项,而且有点“火腿拳头”:

警告: 这个脚本是极端的。它甚至会删除甚至是 GHC 和 Cabal 的自定义配置文件,以及您构建的仍位于 ~/Library/Haskell 中的可执行文件或~/.cabal。谨慎使用;回顾它将要做什么;有备份;警告编剧!

#!/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`

您可能需要添加行来保存和恢复您的配置文件,例如:

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

并将

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

这些行放在 rm 行中。不过,如果您要升级到较新的内容,您可能需要也可能不需要旧的 ~/.cabal/config

请注意,这仅处理当前用户的主目录。如果您有多个用户帐户都使用 Haskell,那么其他帐户也需要清理。 (重复涉及 ~ 的行。)

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

十级心震 2024-12-04 06:24:59

我使用的是 OSX (Lion atm)。我在 /Library/Frameworks/GHC.framework/ (当前和以前的版本)中有 GHC。 /usr/bin 中还有一些符号链接,但这些符号链接将被新安装替换。

如果您使用 cabal (本地)安装软件包,您可能还需要清理 ~/.cabal。如果您有最新的 cabal,您可以使用 cabal install world 轻松地重新安装“新”GHC 版本的所有软件包,然后查找与您之前的 GHC 版本相匹配的目录,如下所示:

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 

这些应该可以安全删除。

希望这对您有所帮助。

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.

迟月 2024-12-04 06:24:59

uninstall-hs 为您完成一些工作;我不确定是多少。

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文