---
name: "pkg_delete"
section: "1"
platform: "openbsd"
package: "man"
version: "8.0-current-20261101"
release: "OpenBSD 8.0-current (2026-11-01)"
platforms: ["openbsd"]
url: "https://new.carta.tech/pkg_delete"
---

# pkg\_delete(1)

delete software package distributions

## NAME

**pkg\_delete** – delete software package distributions

## SYNOPSIS

**pkg\_delete** \[**-acIimnqsVvXx**\] \[**-B** *pkg-destdir*\] \[**-D** *name*\[=*value*\]\] \[*pkg-name* *...*\]

## DESCRIPTION

The **pkg\_delete** command is used to delete packages that have been previously installed with the pkg\_add(1) command.

Package names may be specified either as the package name itself, or as a filename which consists of the package name plus the “.tgz” suffix, or as a full pathname like */var/db/pkg/pkgname*, so that shell wildcards can be used.

Version numbers and flavors( see [packages-specs(7)](/packages-specs/7.md)) can be omitted, unless the resulting specification is ambiguous.

Otherwise, *pkg-name* in **pkg\_delete** may use the same convenient shortcuts as pkg\_add(1): ‘**pkg\_delete** *autoconf*%*2.13*’ will delete *autoconf* from the *2.13* branch.

**pkg\_delete** will [syslog(3)](/syslog/3.md) deletions by default.

**pkg\_delete** relies on the file system information being consistent. In case of a system crash, */var/db/pkg* may become corrupted. Use [pkg\_check(8)](/pkg_check/8.md) to repair things.

**pkg\_delete** may ask questions in interactive mode, or error out otherwise. Interactive mode is the default on a tty, see options **-I/i**.

The options are as follows:

- **-a**

  Delete unused dependencies (packages that are not needed by anything tagged as installed manually). Can be used without *pkgnames*. If used with *pkgnames*, it will only delete non manual installs in the list.

- **-B** *pkg-destdir*

  Set *pkg-destdir* as the prefix to prepend to any object deleted.

- **-c**

  Delete extra configuration files, users and groups mentioned as **@extra**, **@newuser** and **@newgroup** in the packing-list, respectively.

- **-D** *name*\[=*value*\]

  Force removal of the package. *name* is a keyword that states what failsafe should be waived. Recognized keywords include:

  - **baddepend**

    Force the deletion of packages even if they reference nonexistent dependencies.

  - **checksum**

    Verify checksums before deleting files.

  - **dependencies**

    Also delete the whole set of packages that depends upon the requested packages.

  - **nonroot**

    Uninstall even if not running as root.

  - **scripts**

    External scripts may fail.

- **-I**

  Force non-interactive mode. Default is to be interactive when run from a tty.

- **-i**

  Force interactive mode, even if not run from a tty. **pkg\_delete** may ask questions to the user if faced with difficult decisions.

- **-m**

  Causes **pkg\_delete** to always display the progress meter in cases it would not do so by default.

- **-n**

  Don't actually deinstall a package, just report the steps that would be taken if it were.

- **-qq**

  Do not bother with checksums for configuration files.

- **-s**

  Don't actually deinstall packages, report the disk size changes that would happen.

- **-V**

  Turn on statistics output. For now, only displays the number of packages done/total number of packages. Several **-V** will turn on more statistics in the future.

- **-v**

  Turn on verbose output. Several **-v** turn on more verbose output. By default, **pkg\_delete** is almost completely silent, but it reacts to keyboard status requests( see [stty(1)](/stty/1.md)). **-v** turns on basic messages, **-vv** adds relevant system operations, **-vvv** shows most internal computations apart from individual file/directory additions, and **-vvvvv** shows everything.

- **-X**

  Delete everything, except the list of packages that follow.

- **-x**

  Disable progress meter.

## TECHNICAL DETAILS

**pkg\_delete** examines installed package records for the *pkgname* specified,  checks inter-dependencies between installed packages, deletes the package contents in an order respecting dependencies (e.g., packages with dependencies get removed first), and finally removes the package records.

If a package is required by other installed packages not mentioned in the list of packages to remove, **pkg\_delete** will list those dependent packages and refuse to delete the package.

## ENVIRONMENT

- PKG\_CHECKSUM

  If set, verify files checksums during deletion, exactly like **-D****checksum**.

- PKG\_DBDIR

  Where to look for installed packages instead of */var/db/pkg*.

## SEE ALSO

pkg\_add(1), [pkg\_create(1)](/pkg_create/1.md), [pkg\_info(1)](/pkg_info/1.md), [packages-specs(7)](/packages-specs/7.md), [pkg\_check(8)](/pkg_check/8.md)

## AUTHORS

- Jordan Hubbard

  initial design

- Marc Espie

  complete rewrite
