raghu
raghu

Reputation: 109

On Linux, how do I uninstall a version of Perl which was built from source?

I need to un-install a version of Perl which was built from source. The directory from which it was built exists. However I didn't find a make target called 'uninstall'. The Perl version I have is 5.12.2 and is installed on a Fedora distributed Linux.

Upvotes: 5

Views: 13188

Answers (4)

Evan Carroll
Evan Carroll

Reputation: 1

A method that

  1. Assumes installation in a subtree of /usr/local,
  2. doesn't require the build directory
  3. is slightly less accurate

Run the following command,

sudo find /usr/local -name '*perl*' -or -name 'pod2*' -or -name '*cpan*' -exec rm -rf {} \;

Upvotes: 0

Mike D
Mike D

Reputation: 747

Because perl has no 'make uninstall' target, you need to remove the files manually. The best way to do this is to get a complete list of files installed. To do that you need to:

  1. Create a temporary directory, e.g. /usr/local/src/temp/perl
  2. Edit the Makefile in your original perl source directory (hopefully you didn't delete it) and add the path from step 1 above to the beginning of all install lines (e.g. bin = ..., scriptdir = ..., INSTALLPREFIXEXP = ...)
  3. Run make install
  4. Navigate to your temp directory and run: find . -type f > filelist.txt
  5. Edit this file and make sure you actually want to delete eveything in there (you will screw up your system real bad if you mess this up)
  6. Run cat filelist.txt | xargs rm
  7. Manually delete the perl5 library directory (usually at something like /usr/local/lib64/perl5 - you can find it in the filelist.txt file)

That's it, all gone.

Next time isolate it in a separate directory and just symlink it :-)

Upvotes: 6

Jonathan Leffler
Jonathan Leffler

Reputation: 753665

If the Perl is installed in its own directory - say /opt/perl/v5.12.2 - and was built from source, then the 'ultimate sanction' works well:

rm -fr /opt/perl/v5.12.2

I almost always build my own Perl; I always build my Perl so it installs in its own, unique directory; when I finally get around to removing it, this is how I do it.

Upvotes: 2

snoofkin
snoofkin

Reputation: 8895

If you still have the source, you can remove it by using:

make uninstall

while you are in the source directory.

Btw, I sugggest to use checkinstall next time while installing from source. See this

If you (as you said...) dont have a target uninstall, then you will probably will have to remove it by hand.

Upvotes: -1

Related Questions