package Commands

Use the package commands to install and uninstall first- and second-generation packages.

package:install

Installs a package in the target org.

Command Syntax

sfdx force:package:install
-i ID
[-w WAIT]
[-k INSTALLATIONKEY]
[-p PUBLISHWAIT]
[-r]
[-u TARGETUSERNAME]
[--json]
[--loglevel LOGLEVEL]

Parameters

-i | --id ID
Required

The ID of the package version to install (starts with 04t).

Type: id
-w | --wait WAIT
Optional

Maximum number of minutes to wait for installation status. The default is 0.

Type: minutes
-k | --installationkey INSTALLATIONKEY
Optional

Installation key for installing a key-protected package. The default is null.

Type: string
-p | --publishwait PUBLISHWAIT
Optional

Maximum number of minutes to wait for the Subscriber Package Version ID to become available in the target org before canceling the install request. The default is 0.

Type: minutes
-r | --noprompt
Optional

Allow Remote Site Settings and Content Security Policy websites to send or receive data without confirmation.

Type: flag
-u | --targetusername TARGETUSERNAME
Optional

A username or alias for the target org. Overrides the default target org.

Type: string
--json
Optional

Format output as JSON.

Type: flag
--loglevel LOGLEVEL
Optional

The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.

Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: error

Help for package:install

Supply the ID of the package version you want to install. Installs to the default username org unless you supply the username for a different target org.

Examples:

1$ sfdx force:package:install -i 04t6A0000004eytQAA
1$ sfdx force:package:install -i 04t6A0000004eytQAA -u me@my.org

package:install:get

Retrieves the status of a package installation request.

Command Syntax

sfdx force:package:install:get
-i REQUESTID
[-u TARGETUSERNAME]
[--json]
[--loglevel LOGLEVEL]

Parameters

-i | --requestid REQUESTID
Required

The ID of the package install request you want to check.

Type: id
-u | --targetusername TARGETUSERNAME
Optional

A username or alias for the target org. Overrides the default target org.

Type: string
--json
Optional

Format output as JSON.

Type: flag
--loglevel LOGLEVEL
Optional

The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.

Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: error

Help for package:install:get

Displays the status of a package install request.

package:installed:list

Lists all packages installed in the target org.

Command Syntax

sfdx force:package:installed:list
[-u TARGETUSERNAME]
[--json]
[--loglevel LOGLEVEL]

Parameters

-u | --targetusername TARGETUSERNAME
Optional

A username or alias for the target org. Overrides the default target org.

Type: string
--json
Optional

Format output as JSON.

Type: flag
--loglevel LOGLEVEL
Optional

The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.

Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: error

Help for package:installed:list

This command must be run in a project.

Lists all packages installed in the target org.

package:uninstall

Uninstalls a second-generation package from the target org. To uninstall a first-generation package, use the Salesforce user interface.

Command Syntax

sfdx force:package:uninstall
-i ID
[-w WAIT]
[-u TARGETUSERNAME]
[--json]
[--loglevel LOGLEVEL]

Parameters

-i | --id ID
Required

The ID of the second-generation package to uninstall (starts with 04t).

Type: id
-w | --wait WAIT
Optional

Maximum number of minutes to wait for uninstall status. The default is 0.

Type: minutes
-u | --targetusername TARGETUSERNAME
Optional

A username or alias for the target org. Overrides the default target org.

Type: string
--json
Optional

Format output as JSON.

Type: flag
--loglevel LOGLEVEL
Optional

The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.

Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: error

Help for package:uninstall

This command must be run in a project.

Specify the package ID for a second-generation package.

Examples:

1$ sfdx force:package:uninstall --id 04t...
1$ sfdx force:package:uninstall -i 04t... -u <username of target org>

To list the org’s installed packages, run "package:installed:list".

To uninstall a first-generation package, from Setup, enter Installed Packages in the Quick Find box, then select Installed Packages.

package:uninstall:get

Retrieves the status of a package uninstall request.

Command Syntax

sfdx force:package:uninstall:get
-i REQUESTID
[-u TARGETUSERNAME]
[--json]
[--loglevel LOGLEVEL]

Parameters

-i | --requestid REQUESTID
Required

The ID of the package uninstall request you want to check.

Type: id
-u | --targetusername TARGETUSERNAME
Optional

A username or alias for the target org. Overrides the default target org.

Type: string
--json
Optional

Format output as JSON.

Type: flag
--loglevel LOGLEVEL
Optional

The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.

Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: error

Help for package:uninstall:get

Displays the status of a package uninstall request.