Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I cleanly remove my ruby version 1.8.7 from CentOS 5? I installed it by downloading the source code and performed a make.

share|improve this question

You shouldn't install software this way.
Removing software which was installed like this may be dangerous:

  1. unpack the same ruby to /tmp
  2. run:
    ./configure --prefix=/tmp/somedir    # by default prefix points to /usr/local
    make install    # this will install ruby in /tmp/somedir instead of where you've installed it
    cd /tmp/somedir
    find . -type f -exec rm -i /usr/local{} \;    # Use without -i if you are shure
    find . -type d -exec rm -ir /usr/local{} \;

I hope this will help you

share|improve this answer
Interesting idea. You could also use the list of files generated in /tmp/somedir and manually remove the bits from the real installation tree. Either way, the fake installation is an interesting idea. – ewwhite Nov 26 '09 at 21:38

You could also try the technique from this question. Basically look for .installed.list in the directory you built ruby in. This should have a list of all the files installed. One way to remove them all would be

cat .installed.list | xargs rm

Note that this will only delete files, not directories. I guess you could also do

cat .installed.list | xargs rmdir

after the first command. That should clean up the directories aswell. And rmdir will not remove a directory if it still contains files, so it should be safe ...

share|improve this answer
You may need to run the cat .installed.list | xargs rmdir several times to get rid of all the directories it creates. – Iain Jun 2 '10 at 14:34
Or use something like "cat .installed.list | while read F; do test -f $F && rm -r $F; done" – HUB Aug 6 '12 at 9:17

This works for me.

more .installed.list | xargs rm -rfv
share|improve this answer

It will not be easy if you issued configure and make without using --prefix switch, but you can try this way:

  1. Extract file list from the RPM database:

    rpm -qla > list1.txt

  2. Then find all files from your system

    find / > list1.txt

  3. Then diff is your friend:

    diff list1.txt list2.txt > alien_files.txt

In alien_files.txt you'll have the files which weren't installed via rpm (including ruby's). Of course you'll have to filter /proc, /tmp, ... files, but I said that it will not be easy. :)

If you like the RPM philosophy as I do, then read my article on howto install Ruby Enterprise 1.8.7 on CentOS 5 as rpm here:

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.