The following command line arguments are supported:
pkg-name [...]
The named packages are installed. pkg_add will first try to use pkg-name as full URL or path name without any wildcard processing. If that fails, pkg_add will try to match packages using wildcard processing. If that fails as well and pkg-name does not contain any /, the entries of the PKG_PATH variable are searched using the wildcard processing rules.
-A
Mark package as installed automatically, as dependency of another package. You can use
pkg_admin set automatic=YES
to mark packages this way after installation, and
pkg_admin unset automatic
to remove the mark. If you
pkg_add a package without specifying
-A after it had already been automatically installed, the mark is removed.
-C config
Read the configuration file from config instead of the system default.
-f
Force installation to proceed even if prerequisite packages are not installed or the install script fails. Although pkg_add will still try to find and auto-install missing prerequisite packages, a failure to find one will not be fatal. This flag also overrides the fatal error when the operating system or architecture the package was built on differ from that of the host.
-I
If an installation script exists for a given package, do not execute it.
-K pkg_dbdir
Override the value of the PKG_DBDIR configuration option with the value pkg_dbdir.
-L
Don't add the package to any views after installation.
-m
Override the machine architecture returned by uname with machine.
-n
Don't actually install a package, just report the steps that would be taken if it was.
-P destdir
Prefix all file and directory names with
destdir. For packages without install scripts this has the same behavior as using
chroot(8).
-p prefix
Override the prefix stored in the package with prefix.
-R
Do not record the installation of a package. This implies -I. This means that you cannot deinstall it later, so only use this option if you know what you are doing!
-U
Replace an already installed version from a package. Implies -u.
-u
If the package that's being installed is already installed, an update is performed. Installed dependent packages are updated recursively, if they are too old to fulfill the dependencies of the to-be-installed version. See below for a more detailed description of the process.
-V
Print version number and exit.
-v
Turn on verbose output.
One or more
pkg-name arguments may be specified, each being either a file containing the package (these usually ending with the “.tgz” suffix) or a URL pointing at a file available on an ftp or web site. Thus you may extract files directly from their anonymous ftp or WWW locations (e.g.,
pkg_add ftp://ftp.NetBSD.org/pub/pkgsrc/packages/NetBSD/i386/3.1_2007Q2/shells/bash-3.2.9.tgz or
pkg_add http://www.example.org/packages/screen-4.0.tbz). Note: For ftp transfers, if you wish to use
passive mode
ftp in such transfers, set the variable
FTP_PASSIVE_MODE
to some value in your environment. Otherwise, the more standard ACTIVE mode may be used. If
pkg_add consistently fails to fetch a package from a site known to work, it may be because you have a firewall that demands the usage of
passive mode
ftp.