Best way to cleanly uninstall packages?

Uwe Doering gemini at geminix.org
Wed Oct 22 02:14:40 PDT 2003


Hi Chris,

Chris Richards wrote:
> Hi Everyone,
> 
> I have installed 2 packages which inturn installed a bunch of
> dependencies... They are "imageindex-1.0.6" and "gallery-1.4.0.1" I was
> seeing which one I like best - now I have decided I want to keep gallery
> and uninstall imageindex.
> 
> What is the cleanest way to do this? I have noticed that they both have
> common dependencies so I can't just use the "pkg_delete -r" option - I
> am sure this is a common problem and there is probably an easy way to
> uninstall all dependencies for imageindex except for the ones that are
> needed for gallery.

I think the '-r' option of 'pkg_delete' is not what you are looking for 
because it works the other way round.  It additionally deletes packages 
that depend on the package you would like to deinstall.  I understand 
what you would like to do is get rid of packages that the package to be 
deleted depends on, in order to tidy up after deciding on which of the 
two photo gallery packages to keep.

I don't know whether there is a more elegant method that would do this 
in one go, but what I would do is list the required packages with

   pkg_info -r <packagename>

and feed the resulting list of required packages to

   pkg_info -R <packagename> [<packagename> ...]

Pick those packages as additional candidates for removal that list only 
the package that you want to remove in the first place.  Now do the 
whole process again for these additional packages and work your way down 
the dependency tree recursively.  I recommend to make a sketch of the 
relevant parts of the tree on old-fashioned paper in order to not get 
confused.  When you're done with that, delete the candidates top down 
with 'pkg_delete'.

If anyone else knows a more automated way, with the base system tools, 
that is, I would certainly be interested, too.

    Uwe
-- 
Uwe Doering         |  EscapeBox - Managed On-Demand UNIX Servers
gemini at geminix.org  |  http://www.escapebox.net



More information about the freebsd-questions mailing list