package Commands

Use the package commands to develop and install packages.

package:create (Beta)

Creates a package.

This release contains a beta version of the package:create command, which means it’s a high-quality feature with known limitations. The the package:create command isn’t generally available unless or until Salesforce announces its general availability in documentation or in press releases or public statements. We can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features. You can provide feedback and suggestions for the package:create command in the Packaging 2 Beta group in the Trailblazer Community.

Note

Command Syntax

sfdx force:package:create
-n NAME
-t PACKAGETYPE
[-d DESCRIPTION]
[-e]
-r PATH
[-v TARGETDEVHUBUSERNAME]
[--json]
[--loglevel LOGLEVEL]

Parameters

-n | --name NAME
Required

Name of the package to create.

Type: string
-t | --packagetype PACKAGETYPE
Required

Package type for the package.

The options for package type are Managed and Unlocked (Managed=DeveloperManagedSubscriberManaged, Unlocked=DeveloperControlledSubscriberEditable). Managed packages are currently in beta.

These options determine upgrade and editability rules.

Type: string
Permissible values are: Managed, Unlocked
-d | --description DESCRIPTION
Optional

Description of the package.

Type: string
-e | --nonamespace
Optional

Creates the package with no namespace. Available only for unlocked packages. Useful when you’re migrating an existing org to packages. But, use a namespaced package for new metadata.

Type: flag
-r | --path PATH
Required

The path to the directory that contains the contents of the package.

Type: directory
-v | --targetdevhubusername TARGETDEVHUBUSERNAME
Optional

A username or alias for the target Dev Hub org. Overrides the default Dev Hub 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:create

NOTE: This command must be run from within a project.

First, use this command to create a package. Then create a package version.

If you don’t have a namespace defined in your sfdx-project.json file, use --nonamespace.

Your --name value must be unique within your namespace.

Examples:

Run 'sfdx force:package:list' to list all packages in the Dev Hub org.

package:install

Installs a package in the target org.

Command Syntax

sfdx force:package:install
[-w WAIT]
[-k INSTALLATIONKEY]
[-b PUBLISHWAIT]
[-r]
[-p PACKAGE]
[-s SECURITYTYPE]
[-t UPGRADETYPE]
[-u TARGETUSERNAME]
[--json]
[--loglevel LOGLEVEL]

Parameters

-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
-b | --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
-p | --package PACKAGE
Optional

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

Type: string
-s | --securitytype SECURITYTYPE
Optional

Security access type for the installed package.

Type: string
Permissible values are: AllUsers, AdminsOnly
-t | --upgradetype UPGRADETYPE
Optional

For package upgrades, specifies whether to mark all removed components as deprecated (DeprecateOnly) or to delete removed components that can be safely deleted and deprecate the others (Mixed).

Type: string
Permissible values are: DeprecateOnly, Mixed
Default value: Mixed
-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 to install. The package installs in your default target org unless you supply the username for a different target org.

For package upgrades, to specify options for component deprecation or deletion of removed components, include an --upgradetype value. To delete components that can be safely deleted and deprecate the others, specify --upgradetype Mixed (the default). To deprecate all removed components, specify --upgradetype DeprecateOnly. The default is Mixed.

Examples:

package:install:report

Retrieves the status of a package installation request.

Command Syntax

sfdx force:package:install:report
-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:report

Examples:

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

NOTE: This command must be run from within a project.

Examples:

package:list

Lists all packages in the Dev Hub org.

Command Syntax

sfdx force:package:list
[-v TARGETDEVHUBUSERNAME]
[--json]
[--loglevel LOGLEVEL]
[--verbose]

Parameters

-v | --targetdevhubusername TARGETDEVHUBUSERNAME
Optional

A username or alias for the target Dev Hub org. Overrides the default Dev Hub 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
--verbose
Optional

Displays extended package details.

Type: flag

Help for package:list

You can view the namespace, IDs, and other details for each package.

Examples:

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
[-w WAIT]
[-p PACKAGE]
[-u TARGETUSERNAME]
[--json]
[--loglevel LOGLEVEL]

Parameters

-w | --wait WAIT
Optional

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

Type: minutes
-p | --package PACKAGE
Optional

The ID (starts with 04t) or alias of the package version to uninstall.

Type: string
-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

Specify the package ID for a second-generation package.

Examples:

To list the org’s installed packages, run "sfdx force: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:report

Retrieves the status of a package uninstall request.

Command Syntax

sfdx force:package:uninstall:report
-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:report

Examples:

package:update

Updates details about a package. Does not create a package version.

Command Syntax

sfdx force:package:update
-p PACKAGE
[-n NAME]
[-d DESCRIPTION]
[-v TARGETDEVHUBUSERNAME]
[--json]
[--loglevel LOGLEVEL]

Parameters

-p | --package PACKAGE
Required

The ID (starts with 0Ho) or alias of the package to update.

Type: string
-n | --name NAME
Optional

New name of the package.

Type: string
-d | --description DESCRIPTION
Optional

New description of the package.

Type: string
-v | --targetdevhubusername TARGETDEVHUBUSERNAME
Optional

A username or alias for the target Dev Hub org. Overrides the default Dev Hub 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:update

NOTE: This command must be run from within a project.

Specify a new value for each option you want to update.

Examples:

Run "sfdx force:package:list" to list all packages in the Dev Hub org.

package:version:create

Creates a package version in the Dev Hub org.

Command Syntax

sfdx force:package:version:create
[-p PACKAGE]
[-d PATH]
[-f DEFINITIONFILE]
[-b BRANCH]
[-t TAG]
[-k INSTALLATIONKEY]
[-x]
[-w WAIT]
[-a VERSIONNAME]
[-n VERSIONNUMBER]
[-e VERSIONDESCRIPTION]
[-v TARGETDEVHUBUSERNAME]
[--json]
[--loglevel LOGLEVEL]

Parameters

-p | --package PACKAGE
Optional

The ID (starts with 0Ho) or alias of the package to create a version of.

Type: string
-d | --path PATH
Optional

The path to the directory that contains the contents of the package.

Type: directory
-f | --definitionfile DEFINITIONFILE
Optional

The path to a definition file similar to scratch org definition file that contains the list of features and org preferences that the metadata of the package version depends on.

Type: filepath
-b | --branch BRANCH
Optional

The package version’s branch.

Type: string
-t | --tag TAG
Optional

The package version’s tag.

Type: string
-k | --installationkey INSTALLATIONKEY
Optional

Installation key for creating the key-protected package. Either an --installationkey value or the --installationkeybypass flag is required.

Type: string
-x | --installationkeybypass
Optional

Bypasses the installation key requirement. If you bypass this requirement, anyone can install your package. Either an --installationkey value or the --installationkeybypass flag is required.

Type: string
-w | --wait WAIT
Optional

The number of minutes to wait for the package version to be created.

Type: minutes
Default value: 0
-a | --versionname VERSIONNAME
Optional

The name of the package version to be created. Overrides the sfdx-project.json value.

Type: string
-n | --versionnumber VERSIONNUMBER
Optional

The version number of the package version to be created. Overrides the sfdx-project.json value.

Type: string
-e | --versiondescription VERSIONDESCRIPTION
Optional

The description of the package version to be created. Overrides the sfdx-project.json value.

Type: string
-v | --targetdevhubusername TARGETDEVHUBUSERNAME
Optional

A username or alias for the target Dev Hub org. Overrides the default Dev Hub 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:version:create

NOTE: This command must be run from within a project.

The package version is based on the package contents in the specified directory.

To retrieve details about a package version create request, including status and package version ID (04t), run "sfdx force:package:version:create:report -i 08c...".

We recommend specifying the --installationkey to protect the contents of your package and to prevent unauthorized installation of your package.

To list package version creation requests in the org, run "sfdx force:package:version:create:list".

Examples:

package:version:create:list

Lists all requests to create second-generation package versions in the Dev Hub org.

Command Syntax

sfdx force:package:version:create:list
[-c CREATEDLASTDAYS]
[-s STATUS]
[-v TARGETDEVHUBUSERNAME]
[--json]
[--loglevel LOGLEVEL]

Parameters

-c | --createdlastdays CREATEDLASTDAYS
Optional

Filters the list based on the specified maximum number of days since the request was created (starting at 00:00:00 of first day to now; 0 for today).

Type: number
-s | --status STATUS
Optional

Filters the list based on the status of version creation requests.

Type: string
Permissible values are: Queued, InProgress, Success, Error
-v | --targetdevhubusername TARGETDEVHUBUSERNAME
Optional

A username or alias for the target Dev Hub org. Overrides the default Dev Hub 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:version:create:list

Shows the details of each request to create a package version in the Dev Hub org.

All filter parameters are applied using the AND logical operator (not OR).

To get information about a specific request, run "sfdx force:package:version:create:report" and supply the request ID.

Examples:

package:version:create:report

Retrieves details about a package version creation request in the Dev Hub org.

Command Syntax

sfdx force:package:version:create:report
-i PACKAGECREATEREQUESTID
[-v TARGETDEVHUBUSERNAME]
[--json]
[--loglevel LOGLEVEL]

Parameters

-i | --packagecreaterequestid PACKAGECREATEREQUESTID
Required

The ID (starts with 08c) of the package version creation request you want to display.

Type: id
-v | --targetdevhubusername TARGETDEVHUBUSERNAME
Optional

A username or alias for the target Dev Hub org. Overrides the default Dev Hub 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:version:create:report

Specify the request ID for which you want to view details. If applicable, the command displays errors related to the request.

Examples:

To show all requests in the org, run "sfdx force:package:version:create:list".

package:version:list

Lists all package versions in the Dev Hub org.

Command Syntax

sfdx force:package:version:list
[-c CREATEDLASTDAYS]
[-m MODIFIEDLASTDAYS]
[-p PACKAGES]
[-r]
[-o ORDERBY]
[-v TARGETDEVHUBUSERNAME]
[--concise]
[--json]
[--loglevel LOGLEVEL]
[--verbose]

Parameters

-c | --createdlastdays CREATEDLASTDAYS
Optional

Filters the list based on the specified maximum number of days since the request was created (starting at 00:00:00 of first day to now; 0 for today).

Type: number
-m | --modifiedlastdays MODIFIEDLASTDAYS
Optional

Lists the items modified in the specified last number of days, starting at 00:00:00 of first day to now. Use 0 for today.

Type: number
-p | --packages PACKAGES
Optional

Filters results on the specified comma-delimited packages (aliases or 0Ho IDs).

Type: string
-r | --released
Optional

Displays released versions only (IsReleased=true).

Type: flag
-o | --orderby ORDERBY
Optional

Orders the list by the specified package version fields.

Type: string
-v | --targetdevhubusername TARGETDEVHUBUSERNAME
Optional

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

Type: string
--concise
Optional

Displays limited package version details.

Type: flag
--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
--verbose
Optional

Displays extended package version details.

Type: flag

Help for package:version:list

Displays details of each package version in the org.

Use --concise or --verbose to display limited or additional details, respectively.

All filter parameters are applied using the AND logical operator (not OR).

Examples:

package:version:promote

Promotes a package version to released status.

Command Syntax

sfdx force:package:version:promote
-p PACKAGE
[-n]
[-v TARGETDEVHUBUSERNAME]
[--json]
[--loglevel LOGLEVEL]

Parameters

-p | --package PACKAGE
Required

The ID (starts with 04t) or alias of the package version to promote.

Type: string
-n | --noprompt
Optional

Do not prompt to confirm setting the package version as released.

Type: flag;
-v | --targetdevhubusername TARGETDEVHUBUSERNAME
Optional

A username or alias for the target Dev Hub org. Overrides the default Dev Hub 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:version:promote

NOTE: This command must be run from within a project.

Supply the ID or alias of the package version you want to promote. Promotes the package version to released status.

Examples:

package:version:report

Retrieves details about a package version in the Dev Hub org.

Command Syntax

sfdx force:package:version:report
-p PACKAGE
[-v TARGETDEVHUBUSERNAME]
[--json]
[--loglevel LOGLEVEL]
[--verbose]

Parameters

-p | --package PACKAGE
Required

The ID (starts with 04t) or alias of the package to retrieve details for.

Type: string
-v | --targetdevhubusername TARGETDEVHUBUSERNAME
Optional

A username or alias for the target Dev Hub org. Overrides the default Dev Hub 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
--verbose
Optional

Displays extended package version details.

Type: flag

Help for package:version:report

NOTE: This command must be run from within a project.

Examples:

To update package version values, run "sfdx force:package:version:update".

package:version:update

Updates a second-generation package version in the Dev Hub org.

Command Syntax

sfdx force:package:version:update
-p PACKAGE
[-a VERSIONNAME]
[-e VERSIONDESCRIPTION]
[-b BRANCH]
[-t TAG]
[-k INSTALLATIONKEY]
[-v TARGETDEVHUBUSERNAME]
[--json]
[--loglevel LOGLEVEL]

Parameters

-p | --package PACKAGE
Required

The ID (starts with 04t) or alias of the package to update a version of.

Type: string
-a | --versionname VERSIONNAME
Optional

The new package version name.

Type: string
-e | --versiondescription VERSIONDESCRIPTION
Optional

The new package version description.

Type: string
-b | --branch BRANCH
Optional

The new package version branch.

Type: string
-t | --tag TAG
Optional

The new package version tag.

Type: string
-k | --installationkey INSTALLATIONKEY
Optional

The new installation key for the key-protected package. The default is null.

Type: string
-v | --targetdevhubusername TARGETDEVHUBUSERNAME
Optional

A username or alias for the target Dev Hub org. Overrides the default Dev Hub 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:version:update

NOTE: This command must be run from within a project.

Specify a new value for each option you want to update.

Examples:

To display details about a package version, run "sfdx force:package:version:report".