/ docs / pkg-install.8
pkg-install.8
  1  .\"
  2  .\" FreeBSD pkg - a next generation package for the installation and
  3  .\" maintenance of non-core utilities.
  4  .\"
  5  .\" Redistribution and use in source and binary forms, with or without
  6  .\" modification, are permitted provided that the following conditions
  7  .\" are met:
  8  .\" 1. Redistributions of source code must retain the above copyright
  9  .\"    notice, this list of conditions and the following disclaimer.
 10  .\" 2. Redistributions in binary form must reproduce the above copyright
 11  .\"    notice, this list of conditions and the following disclaimer in the
 12  .\"    documentation and/or other materials provided with the distribution.
 13  .\"
 14  .\"
 15  .\"     @(#)pkg.8
 16  .\"
 17  .Dd July 7, 2024
 18  .Dt PKG-INSTALL 8
 19  .Os
 20  .Sh NAME
 21  .Nm "pkg install"
 22  .Nd install packages from remote repositories or local archives
 23  .Sh SYNOPSIS
 24  .Nm
 25  .Op Fl AfIMnFqRXUy
 26  .Op Fl r Ar reponame ...
 27  .Op Fl Cgix
 28  .Ar <pkg-origin|pkg-name|pkg-name-version> ...
 29  .Pp
 30  .Nm
 31  .Op Cm --{automatic,force,no-scripts,ignore-missing,register-only,autoremove}
 32  .Op Cm --{dry-run,fetch-only,quiet,recursive,no-repo-update,yes}
 33  .Op Cm --repository Ar reponame ...
 34  .Op Cm --{case-sensitive,glob,case-insensitive,regex}
 35  .Ar <pkg-origin|pkg-name|pkg-name-version> ...
 36  .Sh DESCRIPTION
 37  .Nm
 38  is used for installation of packages from package repositories or
 39  local archives.
 40  Multiple package names can be specified on the command line, either
 41  explicitly or by matching against package names (or origins) in the repository
 42  catalogues using shell globbing or regular expressions.
 43  .Pp
 44  .Nm
 45  first updates any out of date repository catalogues, unless
 46  .Cm REPO_AUTOUPDATE
 47  has been set to
 48  .Sy NO
 49  in
 50  .Pa pkg.conf .
 51  .Pp
 52  It then creates a work-list of all the package installations to do.
 53  Any already installed and up-to-date packages will be dropped from the
 54  list unless the
 55  .Fl f
 56  (force) option is supplied, in which case those packages will be
 57  reinstalled.
 58  .Pp
 59  The dependencies of packages in the list are examined and any missing
 60  packages are added to the list for installation.
 61  Such implicitly added packages are flagged as candidates for
 62  autoremoval.
 63  See
 64  .Xr pkg-autoremove 8
 65  for details.
 66  .Pp
 67  If a requested package is already installed at the latest version,
 68  .Nm
 69  will check whether its autoremoval flag matches the requested state.
 70  If
 71  .Nm
 72  is run without
 73  .Fl A
 74  and the package is marked as automatically installed,
 75  the user will be prompted to clear the autoremoval flag.
 76  Conversely, if
 77  .Fl A
 78  is specified and the package is not marked as automatic,
 79  the user will be prompted to set it.
 80  See
 81  .Xr pkg-query 8
 82  for finding the autoremoval status of a package, and
 83  .Xr pkg-set 8
 84  for modifying it.
 85  .Pp
 86  Any already installed but out of date packages, either named on the
 87  command line or from the sum of all their dependencies are added to
 88  the work list as upgrade jobs.
 89  The work list is sorted into dependency order and
 90  .Nm
 91  will present it to the user for approval before proceeding, unless
 92  overridden by the
 93  .Fl y
 94  option or the
 95  .Cm ASSUME_ALWAYS_YES
 96  setting in
 97  .Pa pkg.conf .
 98  .Pp
 99  Packages are fetched from the repositories into the local package
100  cache if they are not already present, or if the checksum of the
101  cached package file differs from the one in the repository.
102  Packages may be downloaded from any of the repositories mentioned
103  in
104  .Xr pkg.conf 5
105  or in the files in
106  .Pa /usr/local/etc/pkg/repo .
107  See
108  .Xr pkg-repository 5
109  for details.
110  .Pp
111  Package repository catalogues will be automatically updated whenever
112  .Nm
113  is run by a user ID with write access to the package database,
114  unless disabled by the
115  .Fl U
116  flag or setting
117  .Cm REPO_AUTOUPDATE
118  to
119  .Sy NO
120  in
121  .Xr pkg.conf 5 .
122  .Sh OPTIONS
123  The following options are supported by
124  .Nm :
125  .Bl -tag -width automatic
126  .It Fl A , Cm --automatic
127  Mark the installed packages as automatic.
128  Will be automatically removed if no other packages depend on them.
129  For more information please refer to
130  .Xr pkg-autoremove 8 .
131  .It Fl C , Cm --case-sensitive
132  Make the standard or the regular expression
133  .Fl ( x )
134  matching against
135  .Ar pkg-name
136  case sensitive.
137  .It Fl f , Cm --force
138  Force the reinstallation of the package if already installed.
139  .It Fl g , Cm --glob
140  Treat the package names as shell glob patterns.
141  .It Fl I , Cm --no-scripts
142  If any installation scripts (pre-install or post-install) exist for a given
143  package, do not execute them.
144  When a package is updated, deinstallation
145  scripts (pre-deinstall or post-deinstall) are not run either.
146  .It Fl i , Cm --case-insensitive
147  Make the standard or the regular expression
148  .Fl ( x )
149  matching against
150  .Ar pkg-name
151  case insensitive.
152  This is the default, unless modified by setting
153  .Ev CASE_SENSITIVE_MATCH
154  to true in
155  .Pa pkg.conf .
156  .It Fl M , Cm --ignore-missing
157  Force the installation of the package with missing dependencies.
158  .It Fl n , Cm --dry-run
159  Dry-run mode.
160  The list of changes to packages is always printed, but
161  no changes are actually made.
162  .It Fl F , Cm --fetch-only
163  Do not perform actual installation of packages, merely fetch packages
164  that should be upgraded and detect possible conflicts.
165  .It Fl q , Cm --quiet
166  Force quiet output, except when
167  .Fl n
168  is used, where
169  .Nm
170  will always show packages to be installed, upgraded or deleted.
171  .It Fl R , Cm --recursive
172  When used with
173  .Fl f ,
174  reinstalls any packages that require the given package.
175  .It Fl r Ar reponame , Cm --repository Ar reponame
176  Install packages from only the named repository.
177  This option can be specified multiple times to use several repositories.
178  Packages will be fetched from the named repositories only, irrespective of the configured
179  .Dq enabled
180  status from
181  .Pa repo.conf .
182  .It Fl U , Cm --no-repo-update
183  Suppress the automatic update of the local copy of the repository catalogue
184  from remote.
185  Automatic repository catalogue updates are only attempted when the
186  effective UID of the process has write access to the package database.
187  Otherwise they are silently ignored.
188  .It Fl x , Cm --regex
189  Treat the package names as regular expressions according to the
190  "modern" or "extended" syntax of
191  .Xr re_format 7 .
192  .It Fl X , Cm --register-only
193  Record the package installation in the database but do not extract any files.
194  This also implies
195  .Fl I .
196  .It Fl y , Cm --yes
197  Assume yes when asked for confirmation before package installation.
198  .It Fl l , Cm --local-only
199  Skip the remote repository and only install from local archives.
200  Suppress the automatic update of the repository catalogue.
201  .It Cm --autoremove
202  After installing the requested packages, automatically remove any orphaned
203  packages that were installed as dependencies and are no longer required.
204  This is equivalent to running
205  .Xr pkg-autoremove 8
206  after the installation.
207  Can also be enabled permanently via the
208  .Cm AUTOREMOVE
209  option in
210  .Xr pkg.conf 5 .
211  .It Cm --script-no-exec
212  Do not execute the pre-install and post-install scripts but still log
213  the scripts
214  in the package database for future reference.
215  Unlike
216  .Fl I ,
217  which prevents scripts from both running and being recorded,
218  .Cm --script-no-exec
219  only suppresses execution.
220  .El
221  .Sh ENVIRONMENT
222  The following environment variables affect the execution of
223  .Nm .
224  See
225  .Xr pkg.conf 5
226  for further description.
227  .Bl -tag -width ".Ev NO_DESCRIPTIONS"
228  .It Ev DEFAULT_ALWAYS_YES
229  .It Ev ASSUME_ALWAYS_YES
230  .It Ev CASE_SENSITIVE_MATCH
231  .It Ev HANDLE_RC_SCRIPTS
232  .It Ev PKG_CACHEDIR
233  .It Ev PKG_DBDIR
234  .It Ev REPO_AUTOUPDATE
235  .El
236  .Sh FILES
237  See
238  .Xr pkg.conf 5 .
239  .Sh SEE ALSO
240  .Xr pkg_create 3 ,
241  .Xr pkg_printf 3 ,
242  .Xr pkg_repo_create 3 ,
243  .Xr pkg_repos 3 ,
244  .Xr pkg-keywords 5 ,
245  .Xr pkg-lua-script 5 ,
246  .Xr pkg-repository 5 ,
247  .Xr pkg-script 5 ,
248  .Xr pkg-triggers 5 ,
249  .Xr pkg.conf 5 ,
250  .Xr pkg 8 ,
251  .Xr pkg-add 8 ,
252  .Xr pkg-alias 8 ,
253  .Xr pkg-annotate 8 ,
254  .Xr pkg-audit 8 ,
255  .Xr pkg-autoremove 8 ,
256  .Xr pkg-check 8 ,
257  .Xr pkg-clean 8 ,
258  .Xr pkg-config 8 ,
259  .Xr pkg-create 8 ,
260  .Xr pkg-delete 8 ,
261  .Xr pkg-fetch 8 ,
262  .Xr pkg-help 8 ,
263  .Xr pkg-info 8 ,
264  .Xr pkg-key 8 ,
265  .Xr pkg-lock 8 ,
266  .Xr pkg-plugins 8 ,
267  .Xr pkg-query 8 ,
268  .Xr pkg-register 8 ,
269  .Xr pkg-repo 8 ,
270  .Xr pkg-repositories 8 ,
271  .Xr pkg-rquery 8 ,
272  .Xr pkg-search 8 ,
273  .Xr pkg-set 8 ,
274  .Xr pkg-shell 8 ,
275  .Xr pkg-shlib 8 ,
276  .Xr pkg-ssh 8 ,
277  .Xr pkg-stats 8 ,
278  .Xr pkg-triggers 8 ,
279  .Xr pkg-unregister 8 ,
280  .Xr pkg-update 8 ,
281  .Xr pkg-updating 8 ,
282  .Xr pkg-upgrade 8 ,
283  .Xr pkg-version 8 ,
284  .Xr pkg-which 8