package install

<!-- prettier-ignore-start -->

Install or upgrade a version of a package in the target org.

Description for package install

To install or upgrade a package, specify a specific version of the package using the 04t package ID. The package and the version you specified installs in your default target org unless you supply the username for a different target org.

When upgrading an unlocked package, include the --upgrade-type value to specify whether any removed components are deprecated or deleted. To delete components that can be safely deleted and deprecate the others, specify "--upgrade-type Mixed" (the default). To deprecate all removed components, specify "--upgrade-type DeprecateOnly". To delete all removed components, except for custom objects and custom fields, that don't have dependencies, specify "--upgrade-type Delete". (Note: This option can result in the loss of data that is associated with the deleted components.)

Aliases for package install

force:package:install

Flags

Flag Name (Long) Flag Name (Short) Description
<code>‑‑apex‑compile</code> <code>‑a</code> Type: Value<br>Valid Values: all, package<br>Default value: all<br><br>Compile all Apex in the org and package, or only Apex in the package; unlocked packages only.<br><br>Applies to unlocked packages only. Specifies whether to compile all Apex in the org and package, or only the Apex in the package.<br><br>For package installs into production orgs, or any org that has Apex Compile on Deploy enabled, the platform compiles all Apex in the org after the package install or upgrade operation completes.<br><br>This approach assures that package installs and upgrades don’t impact the performance of an org, and is done even if --apex-compile package is specified.
<code>‑‑api‑version</code> N/A Type: Value<br><br>Override the api version used for api requests made by this command
<code>‑‑flags‑dir</code> N/A Type: Value<br><br>Import flag values from a directory.
<code>‑‑installation‑key</code> <code>‑k</code> Type: Value<br><br>Installation key for key-protected package (default: null).
<code>‑‑json</code> N/A Type: Boolean<br><br>Format output as json.
<code>‑‑no‑prompt</code> <code>‑r</code> Type: Boolean<br><br>Don't prompt for confirmation.<br><br>Allows the following without an explicit confirmation response: 1) Remote Site Settings and Content Security Policy websites to send or receive data, and 2) --upgrade-type Delete to proceed.
<code>‑‑package</code> <code>‑p</code> Type: Value<br>Required<br><br>ID (starts with 04t) or alias of the package version to install.
<code>‑‑publish‑wait</code> <code>‑b</code> Type: Value<br>Default value: 0 minutes<br><br>Maximum number of minutes to wait for the Subscriber Package Version ID to become available in the target org before canceling the install request.
<code>‑‑security‑type</code> <code>‑s</code> Type: Value<br>Valid Values: AllUsers, AdminsOnly<br>Default value: AdminsOnly<br><br>Security access type for the installed package. Available options are AdminsOnly and AllUsers.
<code>‑‑target‑org</code> <code>‑o</code> Type: Value<br>Required<br><br>Username or alias of the target org. Not required if the target-org configuration variable is already set.
<code>‑‑upgrade‑type</code> <code>‑t</code> Type: Value<br>Valid Values: DeprecateOnly, Mixed, Delete<br>Default value: Mixed<br><br>Upgrade type for the package installation; available only for unlocked packages.<br><br>For unlocked package upgrades, set this flag to one of these values:<br><br><ul><li>DeprecateOnly: Mark all removed components as deprecated.</li><li>Mixed: Delete all removed components that can be safely deleted and deprecate the other components.</li><li>Delete: Delete removed components, except for custom objects and custom fields, that don't have dependencies.</li></ul>
<code>‑‑wait</code> <code>‑w</code> Type: Value<br>Default value: 0 minutes<br><br>Number of minutes to wait for installation status.

Examples for package install

Install or upgrade a package version with the specified ID in the org with username "me@example.com":

sf package install --package 04t... --target-org me@example.com

Install or upgrade a package version with the specified alias into your default org:

sf package install --package awesome_package_alias

Install or upgrade a package version with an alias that includes spaces into your default org:

sf package install --package "Awesome Package Alias"

Upgrade an unlocked package version with the specified ID and deprecate all removed components:

sf package install --package 04t... --upgrade-type DeprecateOnly
<!-- prettier-ignore-end -->