What to do if you accidentally installed some experimental project to your system folder? Are here any ways to undo install script. Here is a simple solution.
Preamble
below may work or may not, this is all given as-is, you and only you are responsible person in case of some damage, data loss and so on. But I hope things go smooth!
To undo `make install` I would do (and I did) this:
Idea: check whatever script installs and undo this with simple bash script.
1. Reconfigure your build dir to install to some custom dir. I usually do this: `–prefix=$PWD/install`. For CMake, you can go to your build dir, open CMakeCache.txt, and fix CMAKE_INSTALL_PREFIX value.
2. Install project to custom directory (just run `make install` again).
3. Now we push from assumption, that `make install` script installs into custom dir just same contents you want to remove from somewhere else (usually `/usr/local`). So, we need a script.
3.1. Script should compare custom dir, with dir you want clean. I use this:
anti-install.sh
RM_DIR=$1 PRESENT_DIR=$2 echo "Remove files from $RM_DIR, which are present in $PRESENT_DIR" pushd $RM_DIR for fn in `find . -iname '*'`; do # echo "Checking $PRESENT_DIR/$fn..." if test -f "$PRESENT_DIR/$fn"; then # First try this, and check whether things go plain echo "rm $RM_DIR/$fn" # Then uncomment this, (but, check twice it works good to you). # rm $RM_DIR/$fn fi done popd
3.2. Now just run this script (it will go dry-run)
bash anti-install.sh <dir you want to clean> <custom installation dir>
E.g. You wan’t to clean /usr/local, and your custom installation dir is /user/me/llvm.build/install, then it would be
bash anti-install.sh /usr/local /user/me/llvm.build/install
3.3. Check log carefully, if commands are good to you, uncomment `rm $RM_DIR/$fn` and run it again. But stop! Did you really check carefully? May be check again?
Good luck!