Everywhere that GHC/Haskell Platform installs - haskell

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.

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

Related

Is there any difference between rm -r and rm -R?

Title is Description.
I just wonder there is any difference between rm -r and rm -R.
Linux man description is seemed like they are totally same(and one more, --recursive), but many people use -r and -R like they aren't same.
So I want to know about not only its functional difference but its practical(or conventional) difference.
Could anyone let me know about this?
According to the OpenGroup / POSIX specification for rm, the -r and -R options are equivalent.
Source: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/rm.html
This probably applies to all modern UNIX / Linux variants.
But it wasn't always that way:
The -R option did not exist in v5 UNIX; see here, page 97.
Or in v7 UNIX; see https://www.unix.com/man-page/v7/1/rm/.
It apparently was introduced in 4.2bsd; see https://linuxgazette.net/issue49/fischer.html ... as meaning the same as -r.
The reason for adding -R was for compatibility with other commands that use -R to mean recursive. (For example chmod ... where -r means "remove read permission".)
Its the same.
# rm --help | grep directories.
-r, -R, --recursive remove directories and their contents recursively
By default, rm does not remove directories. Use the --recursive (-r or -R)
The man-page mentions:
-r, -R, --recursive
remove directories and their contents recursively
So, at least on my machine, it's the same.
The two options are equivalent, by default, rm does not remove directories. And by using the --recursive (-r or -R) option to remove each listed directory, too, along with all of its contents.

How i can remove ghdl 0.29 from Debian?

I follow this steps to install GHDL compiler in my Debian, but now I need to uninstall this compiler to install x64 version, and I can't.
By downloading the binaries and unpacking them manually:
$ wget http://ghdl.free.fr/site/uploads/Main/ghdl-i686-linux-latest.tar
$ sudo tar xvf ghdl-i686-linux-latest.tar
(This generates the file ghdl-0.29-i686-pc-linux.tar.bz2)
$ cd ghdl-0.29-i686-pc-linux
$ sudo tar -C / -jxvf ghdl-0.29-i686-pc-linux.tar.bz2
(This copy the files to /usr/local/bin and /usr/local/lib)
I have used dpkg --purge ghdl, but if I use ghdl --version, the ghdl 0.29 still in the system.
How can I remove it?
faced the same situation and this is how i did it:
goto where your tarball is and use this command
sudo tar -tf ghdl-0.29-i686-pc-linux.tar.bz2 | sed 's/^..//' | parallel sudo rm -rf
explanation:
tar -tf ghdl-0.29-i686-pc-linux.tar.bz2 List all files in archive.tar
sed 's/^..//' Removes initial directory characters
parallel sudo rm -rf removes matching files
this will leave some empty directories at /usr/local and if you want to get rid of them you can use
sudo find /usr/local/* -type d -empty -delete

How to remove a file with special characterictics

Hi I just created a file by mistake, doing a tar actually, anyway the problem I have is that I can't remove that file. It is called --exclude-tag-under=hey.txt
I am trying to use rm -rf command but it doesn't do the trick. this is the output
[root]# rm -rf '--exclude-tag-under\=hey.txt'
rm: unrecognized option '--exclude-tag-under\=hey.txt'
Try 'rm --help' for more information.
the problem here is that the command rm is recognizing the file as a flag and thats a problem, I've tried also
rm -rf *hey.txt
but it doesnt work neither
I've also tried to change the name of the file but its the same problem
Prepend ./ like this: rm ./--exclude-tag-under\=hey.txt
When in doubt, check the man pages.
Running man rm will give you the rm man page, which, on Linux and OpenBSD (the ones I have tested) at least, will have a section saying:
To remove a file whose name starts with a '-', for example '-foo', use
one of these commands:
rm -- -foo
rm ./-foo
Use rm -- --exclude-tag-under=hey.txt
$ ls
--exclude-tag-under=hey.txt
test
$ rm -- --exclude-tag-under=hey.txt
$ ls
test

How to uninstall gcc installed from source?

How can I uninstall a gcc build which I installed from source.I am using gcc 4.9 and I'm on ubuntu 12.04.
Or is there a way to upgrade to latest gcc versions through the ubuntu repository?
When you build a package from source there is unfortunately no magic uninstall usually, however you can approximate this, credit to this mailing list thread.
Basically you should install again into a temporary directory and list all the files created in said directory, then you can delete all of them from the main system through a script.
Here is an example of a script to uninstall GCC in this way:
make install DESTDIR=/tmp/gccinst
find /tmp/gccinst | sed -e s,/tmp/gccinst,, | \
(while read F; do rm "$F"; done)
Run it from inside the gcc source directory as root.
To answer your second question you can install the latest gcc available in the ubuntu repo with:
apt-get install gcc
Overlay repos may have newer versions, I have seen a suggestion there is a newer version at ubuntu-toolchain-r/test (install via):
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
But I am not sure if they have added 4.9 there yet. If not you will indeed have to install from source.
EDIT:
It looks like #roelofs found a better guide to install the repo in his answer, so go look there too and remember to give him an upvote if it helps :)
In GCC 5.1.0, although there is no top-level uninstall target, some directories do have it, in particular gcc, so you can do:
cd build/gcc
sudo make uninstall
This does not remove everything that was installed, but it removes major executables like gcc, g++, cpp... contained in that directory, so it might be enough.
Vality has a great start
make install DESTDIR=/tmp/gccinst
But his cleanup command has a few problems. First, it passes directories to rm, including the usual directories (such as /usr). We can fix this via -type f:
find /tmp/gccinst -type f | sed -e s,/tmp/gccinst,, | \
(while read F; do rm "$F"; done)
Getting rid of the directories that this leaves empty...
find /tmp/gccinst -depth -type d -not -empty | sed -e s,/tmp/gccinst,, | \
(while read F; do rmdir -p --ignore-fail-on-non-empty "$F"; done)
add to Vality and Ben. If you do this from your own login shell:
find $HOME/tmp/gccinst/ -type f | sed -e s,$HOME/tmp/gccinst,, | (while read F; do rm **-f** "$F" ; done)
Need -f flag or the script may not run if there's some permission issue.
/root/ihome3/gcc-4.6.3/gcc-build-4.6.3/gcc
[root#izwz93atpyz gcc]# make uninstall
rm -rf /usr/local/bin/c++
rm -rf /usr/local/bin/g++
rm -rf /usr/local/share/man/man1/g++.1
rm -rf /usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.6.3
rm -rf /usr/local/libexec/gcc/x86_64-unknown-linux-gnu/4.6.3
rm -rf /usr/local/bin/gcc
rm -f /usr/local/bin/cpp
if [ x != x ]; then \
rm -f /usr/local//cpp; \
else true; fi
rm -rf /usr/local/bin/gcov`enter code here`
rm -rf /usr/local/share/man/man1/gcc.1
rm -rf /usr/local/share/man/man1/cpp.1
rm -f /usr/local/share/info/cpp.info* /usr/local/share/info/gcc.info*
rm -f /usr/local/share/info/cppinternals.info* /usr/local/share/info/gccint.info*
[root#izwz93atpalb56zydy9bpyz gcc]# pwd
/root/ihome3/gcc-4.6.3/gcc-build-4.6.3/gcc
the following operation isreally ok. when you make one gcc from source code and make install at gcc-build,then it will generaton one gcc direction at source code's top direction. cd $source_code_top/gcc , then make uninstall. it will purge remove gcc from you linux system.
The highest available version of GCC in the 12.04 repositories is 4.6. You can use the package manager to install a newer version, but you will have to add a PPA. This link should help, although it is for a slightly older version of GCC (but can be used for the newest version).
As a commenter pointed out, if your own built version of GCC was compiled with the --prefix parameter, the entire installation should be in that directory under /usr/local or wherever you installed it, and can be removed.

mv command not working - Error: no package mv available

run the mv command but nothing happened so I tried to install it:
# yum install mv
then i got the Nothing to do response with error : no package mv available
Any pointers on how to set up the mv command in Apache 2.2.15 on Centos 6.
Thank you very much in advance
N.B The last 3 lines after issuing the yum install mv:
Setting up Install Process
No package mv available.
Error: Nothing to do
Please explain nothing happened.
mv belongs to the coreutils. If you don't have mv installed then your system is seriously broken. But I'm very sure you have mv installed, otherwise you would see an error message like mv: command not found.
If there is no error, then mv won't print any output at all. This is the intended behavior. If you want to force output, then append the argument -v for verbose mode.
You can use the type command to see if your mv has been incorrectly aliased to something else.
Mine is:
$ type mv
mv is /bin/mv
Yours may be something like
$ type mv
mv is an alias for
You can use the unalias command to correct this type of problem.
$ unalias mv

Resources