Uninstalling subversion (or any package you’ve compiled manually)


I compiled subversion 1.4.4 and its dependencies (apr, neon) from source when I first got my Macbook, before I had installed MacPorts. Recently I wanted to upgrade to subversion 1.5, and also remove any trace of my previous compile, so I went to my src folder where I had subversion untarred and tried:

~/Documents/src/subversion-1.4.4$ make uninstall
make: *** No rule to make target `uninstall'.  Stop.

Checking out a couple forums I found this had been brought up before and people felt that maintaining an uninstall target in the makefile was unwieldly and wouldn’t be done any time soon. GNU Stow was suggested as a package watchdog, but this cannot be applied retroactively obviously.

The best solution came in the form of using gfind (GNU find), which I first had to install:

sudo port install findutils

Then run:

gfind /usr/local -printf '%T@ ' -ls | sort -n > tfiles

This will put a list of all files in /usr/local ordered by their time-modified fields into svnfiles. Opening this file I found the first mention of apr which had a bunch of entries right before neon which came right before libsvn and svn. I extracted all lines referencing the above 3 packages in the same approximate time-frame and saved them to a new file, svnfilelist.

more svnfilelist | awk '{print $12;}' > svnfilenames
more svnfilenames | xargs sudo rm -rf

Do not do this without editing the file list by hand, otherwise you will delete a lot of things you don’t want to delete. It’s not my fault, etc.

Share this post
  • Digg
  • StumbleUpon
  • Reddit
  • del.icio.us
  • Facebook
  • muti
  • Mixx
  • Google
  • laaik.it

Tags: , , , ,

This entry was posted on Monday, September 22nd, 2008 at 8:07 pm and is filed under Hacks. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

One Response to “Uninstalling subversion (or any package you’ve compiled manually)”

  1. panzi said this on

    You should change the last 2 commands to:

    cat svnfilelist | awk ‘{print $12;}’ > svnfilenames
    cat svnfilenames | while read name; do if [ -f "$name" ]; then echo “$name”; fi; done > svnfilenames2
    cat svnfilenames2 | xargs sudo rm -rf

    This filters out the directories because directories like /usr/bin could end up in the list, too!

Leave a Reply