package install

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

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.)

force:package:install

Flag Name (Long)Flag Name (Short)Description
‑‑apex‑compile‑aType: Value
Valid Values: all, package
Default value: all

Compile all Apex in the org and package, or only Apex in the package; unlocked packages only.

Applies to unlocked packages only. Specifies whether to compile all Apex in the org and package, or only the Apex in the package.

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.

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.
‑‑api‑versionN/AType: Value

Override the api version used for api requests made by this command
‑‑flags‑dirN/AType: Value

Import flag values from a directory.
‑‑installation‑key‑kType: Value

Installation key for key-protected package (default: null).
‑‑jsonN/AType: Boolean

Format output as json.
‑‑no‑prompt‑rType: Boolean

Don’t prompt for confirmation.

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.
‑‑package‑pType: Value
Required

ID (starts with 04t) or alias of the package version to install.
‑‑publish‑wait‑bType: Value
Default value: 0 minutes

Maximum number of minutes to wait for the Subscriber Package Version ID to become available in the target org before canceling the install request.
‑‑security‑type‑sType: Value
Valid Values: AllUsers, AdminsOnly
Default value: AdminsOnly

Security access type for the installed package. Available options are AdminsOnly and AllUsers.
‑‑target‑org‑oType: Value
Required

Username or alias of the target org. Not required if the target-org configuration variable is already set.
‑‑upgrade‑type‑tType: Value
Valid Values: DeprecateOnly, Mixed, Delete
Default value: Mixed

Upgrade type for the package installation; available only for unlocked packages.

For unlocked package upgrades, set this flag to one of these values:

  • DeprecateOnly: Mark all removed components as deprecated.
  • Mixed: Delete all removed components that can be safely deleted and deprecate the other components.
  • Delete: Delete removed components, except for custom objects and custom fields, that don’t have dependencies.
‑‑wait‑wType: Value
Default value: 0 minutes

Number of minutes to wait for installation status.

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

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

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

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