Subject: Re: Removing All Packages
To: Ian Zagorskih <>
From: D'Arcy J.M. Cain <>
List: tech-pkg
Date: 10/29/2004 07:53:59
On Fri, 29 Oct 2004 14:00:49 +0700
Ian Zagorskih <> wrote:
> On Friday 29 October 2004 08:53, Daniel Bolgheroni wrote:
> > Hi,
> >
> > I trying to remove _all_ packages from my system, with the minimal
> > amount of commands possible.
> >
> > What's the easy way to do this?
> >
> > Thank you.
> # pkg_delete -r \*

Make damn sure that you are in the right directory and that you get the
direction of that slash correct.  Safer is just "rm -rf /usr/pkg
/var/db/pkg" as someone else suggested.

By the way, once in a while I like to make sure that I have a clean
installation of pkgsrc but I can't necessarily wipe them all out while I
rebuild.  KDE and OpenOffice take days just by themselves on some
machines.  What I do is like above except that I just wipe out the
database.  The steps I do are;

1. rm -rf /var/db/pkg
2. Build the packages.  I have a script that builds the ones I want.
3. Remove any old files from pkg using find(1)
4. rm -rf /var/db/pkg again
5. Build packages again in case there are some older files installed by

I may lose a few files at step 3 temporarily but mostly I am never
without a system while I do this.  The only problem I have is that some
packages fail if the files exist but they think that they don't have to
worry about it since it is a new installation.  I just handle those
manually.  One of these days I will add a little post build stuff to
handle those cases.

D'Arcy J.M. Cain <>