---
name: "pkg_subst"
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_subst"
---

# pkg\_subst(1)

substitute variables' values in files

## NAME

**pkg\_subst** – substitute variables' values in files

## SYNOPSIS

**pkg\_subst** \[**-ci**\] \[**-B** *basedir*\] \[**-D** *name*\[=*value*\]\] \[**-g** *group*\] \[**-m** *mode*\] \[**-o** *owner*\] \[*file* *...*\]

## DESCRIPTION

**pkg\_subst** is used within the ports tree to substitute variable values, using the exact same conventions used by [pkg\_create(1)](/pkg_create/1.md). Constructs like ${VAR} will be replaced with the variable value, according to **-D** *name*\[=*value*\] options.

The options are as follows

- **-B** *basedir*

  Specify a basedir in which we know file properties. It is forbidden to copy files from elsewhere without **-m** *mode*.

- **-c**

  Copy and substitute. Number of *file* arguments must be even. They are paired as *src1* *dest1*, *src2* *dest2* *...* and each *src* file is substituted and copied into the corresponding *dest* file.

-

  **-D** *name*\[=*value*\] Define *name* to *value*, or to 1 if no value is given.

- **-g** *group*

  Change group of destination file to *group*.

- **-i**

  Ignore changes to group or owner that failed.

- **-m** *mode*

  Change mode of destination file to *mode*.

- **-o** *owner*

  Change owner of destination file to *owner*.

If no *file* arguments is given, **pkg\_subst** acts as a filter from stdin to stdout.

Without **-c**, each *file* is backed up as *file.beforesubst* before the substitution occurs.

## SEE ALSO

[install(1)](/install/1.md), [pkg\_create(1)](/pkg_create/1.md)
