Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages


home | help
PKG_CUTLEAVES(1)	  BSD General Commands Manual	      PKG_CUTLEAVES(1)

     pkg_cutleaves -- deinstall	'leaf' packages

     pkg_cutleaves [-cFglRVx]

     pkg_cutleaves finds installed "leaf" packages, i.e. packages that are not
     referenced	by any other installed package,	and lets you decide for	each
     one if you	want to	keep or	deinstall it (via pkg_delete(1)). Once the
     packages marked for removal have been flushed/deinstalled,	you'll be
     asked if you want to do another run (i.e. to see packages that have be-
     come 'leaves' now because you've deinstalled the package(s) that depended
     on	them.  Note: see -R below to bypass interactive	dependency removal).
     In	every run you will be shown only packages that you haven't marked for
     keeping, yet.

     Note that your package registry database should be	up to date for this to
     work properly, so it might	be a good idea to run pkgdb(1) before running

     The following command line	arguments are supported:

     -c	 When listing leaf packages, also print	their comments/short descrip-
	 tions.	Will be	ignored	unless the -l parameter	is given, too.

     -F	 Run "pkgdb -F"	after each deinstallation run, to make sure the	pack-
	 age registry database is up to	date. (	Note: This is mostly for con-
	 venience; it shouldn't	be necessary to	run "pkgdb -F" after each run,
	 but it	doesn't	hurt, either.)

     -L	 Interpret exclude file	as a list of leaf packages that	should be in-
	 stalled. Report lint such as lines that match no installed packages
	 or excluded packages that are not leaves.

     -g	 Generate the exclude list from	kept or	installed (when	run with -l or
	 -L) leaf packages.

     -l	 List leaf packages only, one per line,	and don't ask for anything to
	 be deinstalled.

     -V	 Visual	mode. Will compile a list of leaf packages and invoke the
	 user's	EDITOR.	 Lines or package names	that are deleted in the	editor
	 will then be removed.

     -R	 Autoprune mode. Automatically deinstall non-required packages on
	 which the removed leaf	packages depended. Will	not remove packages on
	 the exclude list if -x	is also	in effect.

     -x	 Exclude packages matching expressions given in	the exclude file.

     +o	 Interactively cut leaf	packages using the current exclude list:

	       pkg_cutleaves -x

     +o	 List all current leaf packages	with comments:

	       pkg_cutleaves -lc

     +o	 List packages not currently excluded and regenerate a new exclude
	 file with both	the listed and previously excluded packages:

	       pkg_cutleaves -lxg

     +o	 Interactively cut current leaf	packages and remove newly discovered
	 leaves, i.e. dependencies, automatically:

	       pkg_cutleaves -R

     +o	 The same as the previous example but use the current exclude list to
	 filter	all first-level	leaves and any newly discovered	leaves.	Gener-
	 ate a new exclude file	with the remaining leaves:

	       pkg_cutleaves -Rxg

     +o	 Find exclude patterns that match nothing and those that match re-
	 quired	packages, i.e. non-leaves:

	       pkg_cutleaves -L

	     An	optional list for excluding packages when the -x or -L options
	     are given.	If the beginning of a package's	name matches any line
	     (except comment or	empty lines) in	this file, the package will
	     not be listed/offered for removal (e.g., a	line saying just
	     XFree86 will exclude all packages with names starting with
	     "XFree86" ). The list can be auto-generated with the -g option.

     The following environment variables will be used in visual	mode:

     EDITOR  The editor	specified by the variable EDITOR will be invoked in-
	     stead of the default editor vi(1).

     pkg_deinstall(1), pkgdb(1), portsclean(1)

     Stefan Walter <>

FreeBSD				March 20, 2008			       FreeBSD


Want to link to this manual page? Use this URL:

home | help