Newer Version Available

This content describes an older version of this product. View Latest

Update Salesforce CLI

If you want to ensure that you’re running the latest version of Salesforce CLI, you can manually update it.

If You Installed Salesforce CLI Using the Installer

To install the latest Salesforce CLI and plug-in versions, run:
1sfdx update
2
3sfdx-cli: Updating CLI from 7.105.1-32db2396ed to 7.106.1-2fb9e41053... done
4sfdx-cli: Updating CLI... done

By default, the CLI periodically checks for and installs updates. To disable auto-update, set the SFDX_AUTOUPDATE_DISABLE environment variable to true.

If You Installed Salesforce CLI Using npm

The auto-update option isn’t available. When a new version of the CLI is available, run this command::
1npm install --global sfdx-cli

Determine How You Installed Salesforce CLI

Because the method to update Salesforce CLI differs depending on whether you used the installers or npm, you must know how you installed before you can update. In case you forgot, here are two ways to determine how you installed Salesforce CLI:

  • Run sfdx update. If Salesforce CLI updates, then you installed with the installers. If the command returns this or similar warning, then you installed with npm:
    1sfdx update
    2 ›   Warning: Use "npm update --global sfdx-cli" to update npm-based installations.
    3sfdx-cli: Updating CLI... not updatable
  • If you’ve installed Node.js, run npm list -g --depth 0. If the displayed list includes the entry sfdx-cli@<version>, then you installed Salesforce CLI with npm.

Disable Automatic Update of the CLI

When you run a command, Salesforce CLI checks to see if you have the latest version. If not, the CLI automatically updates itself. You can disable this automatic update with an environment variable.

To remain on the current version of the CLI and disable automatic updates, set the SFDX_AUTOUPDATE_DISABLE environment variable to true. How you set an environment variable is different for different operating systems. See the operating system vendor’s help for instructions on how to set environment variables.