Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 08 Dec 2015 23:04:51 -0500
From:      "Garance A Drosehn" <>
To:        "Matthias Apitz" <>
Subject:   Re: remove all installed packages
Message-ID:  <>
In-Reply-To: <20151208200303.GA2194@c720-r285885-amd64>
References:  <20151208200303.GA2194@c720-r285885-amd64>

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help
On 8 Dec 2015, at 15:03, Matthias Apitz wrote:

> Hello,
> Is it enough to remove all installed packages, just doing
> # rm -f /usr/local/*
> # rm -f /var/db/pkg/*
> Anything else?

I've done this from time-to-time to rebuild and modernize all of my
ports, and to also make sure that I have removed all old cruft.  The
process I do has more steps than what you are planning to do, but
that is basically what I do.

There are a few risks in doing it the way you have there.  You may end
up removing some binaries that you will wish you had if something does
go wrong.  At the very least, I recommend that you save a copy of
everything in /usr/local/etc in /usr/BAK-local/etc in case you'll need
some configuration file that you don't realize you will need.  And if
you have enough space, also save /usr/local/bin in /usr/BAK-local/bin.
After you have everything rebuilt then you won't care about the copies,
but they might come in very useful if something goes haywire.

I'd also suggest that you do the removing in one session, and then
start a brand new login session before you start to build (or otherwise
install) the first port that you want.  That way you'll know the new
session is not depending on anything which is in the older version
of /usr/local.

If you have a lot of available space which you could use to create
some new partitions, then I could tell you the longer process which
I go through.  I also get rid of everything at once (instead of
asking pkg to deinstall each package), but I do it in a way where
I don't have to commit to the newly rebuilt /usr/local until I'm
pretty sure that everything in it is working, and that I haven't
lost anything.

Garance Alistair Drosehn                =
Senior Systems Programmer               or
Rensselaer Polytechnic Institute;             Troy, NY;  USA

Want to link to this message? Use this URL: <>