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

FreeBSD Manual Pages

  
 
  

home | help
PKG-DELETE(8)		     System Manager's Manual		   PKG-DELETE(8)

NAME
     pkg delete -- deletes packages from the database and the system

SYNOPSIS
     pkg delete [-DfnqRy] [-Cgix] [-G exclude-glob] pkg-name ...
     pkg delete [-Dnqy] [-G exclude-glob] -a

     pkg delete [--{no-scripts,force,dry-run,quiet,recursive,yes,autoremove}]
	 [--{case-sensitive,glob,case-insensitive,regex}] pkg-name ...
     pkg delete [--{no-scripts,dry-run,quiet,yes,autoremove}] --all

DESCRIPTION
     pkg  delete  is  used for deleting installed packages from the system.  pkg
     delete creates a work-list of all the installed packages matching the pack-
     age names on the command line.  The list is presented to the user.  If  the
     user  confirms  that  they  do  want  to  remove  those packages, or if the
     ASSUME_ALWAYS_YES configuration option is set, pkg delete proceeds  to  re-
     move the listed packages.

     If  the  set  of packages to be deleted would leave installed packages with
     unfulfilled dependencies, pkg delete will add the packages with unfulfilled
     dependencies to the list of packages to be deleted, unless forced	to  pro-
     ceed without deleting any other packages by the -f option.

     pkg  delete avoids deleting itself unless named specifically on the command
     line.  So, for instance, pkg delete -a will delete all packages except  for
     the pkg(8) package.  To force all packages to be removed without exception,
     use pkg delete -fa.

OPTIONS
     The following options are supported by pkg delete:

     -a, --all	Deletes all installed packages except for pkg(8) from the system
		and  cleans the database of information related to removed pack-
		ages.

     -C, --case-sensitive
		Make the standard or regular expression  (-x)  matching  against
		pkg-name  case	sensitive.  This is the default, unless modified
		by setting CASE_SENSITIVE_MATCH to false in pkg.conf.

     -D, --no-scripts
		If a deinstallation script exists for a given  package,  do  not
		execute it.

     -f, --force
		Forces	packages to be removed despite leaving unresolved depen-
		dencies.

     -G glob, --exclude-glob glob
		Exclude packages whose names match the given shell glob  pattern
		from deletion.	This option may be specified multiple times.  It
		is  particularly  useful  in  combination  with -a to delete all
		packages except those matching	the  exclusion	pattern(s).   In
		combination  with  the -a or --all flag, causes pkg(8) to be re-
		moved as well as all other packages.

     -g, --glob
		Treat the package names as shell glob patterns.

     -i, --case-insensitive
		Make the standard or regular expression  (-x)  matching  against
		pkg-name case insensitive.

     -n, --dry-run
		Dry run mode.  The list of packages to delete is always printed,
		but no packages are actually deleted.

     -q, --quiet
		Force  quiet  output,  except  where  -n  is also used, when pkg
		delete will show the list of packages to be deleted.

     -R, --recursive
		Delete all packages that require the listed packages as well.

     -x, --regex
		Treat the package names as regular expressions according to  the
		"modern" or "extended" syntax of re_format(7).

     -y, --yes	Assume yes when asked for confirmation before package deletion.

     --autoremove
		After  deleting the requested packages, automatically remove any
		orphaned packages that were installed as dependencies and are no
		longer required.  This	is  equivalent	to  running  pkg-autore-
		move(8) after the deletion.  Can also be enabled permanently via
		the AUTOREMOVE option in pkg.conf(5).

     --script-no-exec
		Do  not execute the pre-deinstall and post-deinstall scripts but
		still log the scripts in the package database for future  refer-
		ence.	Unlike	-D, which prevents scripts from both running and
		being recorded, --script-no-exec only suppresses execution.

ENVIRONMENT
     The following environment variables affect the  execution	of  pkg  delete.
     See pkg.conf(5) for further description.

     DEFAULT_ALWAYS_YES

     ASSUME_ALWAYS_YES

     HANDLE_RC_SCRIPTS

     PKG_DBDIR

     CASE_SENSITIVE_MATCH

FILES
     See pkg.conf(5).

EXAMPLES
     Delete all packages except those from the FreeBSD base system:
	   # pkg delete -af -G "FreeBSD-*"

     Delete all packages except base and pkg packages:
	   # pkg delete -af -G "FreeBSD-*" -G "pkg-*"

SEE ALSO
     pkg_checksum(3),  pkg_create(3), pkg_printf(3), pkg_repo_create(3), pkg_re-
     pos(3),   pkg-keywords(5),   pkg-lua-script(5),   pkg-repository(5),   pkg-
     script(5),  pkg-triggers(5), pkg.conf(5), pkg(8), pkg-add(8), pkg-alias(8),
     pkg-annotate(8), pkg-audit(8), pkg-autoremove(8), pkg-check(8),  pkg-check-
     sum(8),  pkg-clean(8),  pkg-config(8),  pkg-create(8),  pkg-fetch(8),  pkg-
     help(8), pkg-info(8), pkg-install(8),  pkg-key(8),  pkg-lock(8),  pkg-plug-
     ins(8),  pkg-query(8),  pkg-register(8),  pkg-repo(8), pkg-repositories(8),
     pkg-rquery(8), pkg-rwhich(8), pkg-search(8), pkg-set(8), pkg-shell(8), pkg-
     shlib(8),	pkg-ssh(8),  pkg-stats(8),  pkg-triggers(8),  pkg-unregister(8),
     pkg-update(8),   pkg-updating(8),	 pkg-upgrade(8),   pkg-version(8),  pkg-
     which(8)

FreeBSD ports 15.quarterly	 April 17, 2026 		   PKG-DELETE(8)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=pkg-remove&sektion=8&manpath=FreeBSD+Ports+15.1.quarterly>

home | help