Newer Version Available

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

Install the Salesforce CLI

Use the CLI commands to create environments for development and testing, synchronize source code between your scratch orgs and version control system, and execute test suites.

Install the CLI on macOS

You install Salesforce CLI on macOS with a .pkg file.
  1. Download the .pkg file.
  2. Double-click the .pkg file.

Install the CLI on Windows

You install the Salesforce CLI on Windows with an .exe file.
Download and run the Windows installer.

The Salesforce CLI works best within the native Windows command prompt (cmd.exe) and the Microsoft Powershell. We do not recommend using the Salesforce CLI with a Linux terminal emulator, such as Windows 10 Subsystem for Linux, cygwin, or MinGW, because support for bugs is limited.

Warning

Install the CLI on Linux

The Linux version of Salesforce CLI is distributed as a tarball.

Find the download URL for your tarball from this manifest file. The downloads section lists unversioned URLs for the latest installers, which are especially useful for CI use cases. Select the URL based on your target platform.

  1. Download or wget one of these tarballs.
    1wget https://developer.salesforce.com/media/salesforce-cli/sfdx-linux-amd64.tar.xz
  2. Create an sfdx directory.
    1mkdir sfdx
  3. Unpack the contents for your tarball version:
    1tar xJf sfdx-linux-amd64.tar.xz -C sfdx --strip-components 1

    -C unpacks the contents in the sfdx directory, while --strip-components 1 removes the root path component.

  4. Run the install script.
    1./sfdx/install

    The Salesforce CLI is installed in /usr/local/bin/sfdx. The installers are designed to provide appropriate permissions to the installation directories. If you receive permission or access errors that you can’t address by using sudo or chmod, try installing the CLI using npm.

Install the CLI with npm

If you've installed Node.js on your computer, you can use npm to install Salesforce CLI. This method lets you install Salesforce CLI from the command line and can be especially useful for continuous integration (CI) use cases.

This installation method is a good option if you don’t have administrator permissions on your workstation, or if group policy blocks CLI installation and updates. Installing the CLI with npm doesn’t require root permissions.

  1. Ensure that the long-term support (Active LTS) version of Node.js is installed on your computer. To install the LTS version, go to https://nodejs.org/en/download/. To check your version number, run:
    1node --version
  2. Run this command.
    1npm install sfdx-cli --global

    If you receive a permission error when installing the CLI using npm, we recommend not using sudo. See Fixing npm permissions.

Install a Previous Version of Salesforce CLI

Salesforce CLI (sfdx-cli) v7 or later is required to install v45.8.0 or later of the salesforcedx plug-in. To install an earlier version of Salesforce CLI, run this command, which installs v6:
1npm install sfdx-cli@6 --global

Verify Your Installation

Verify your Salesforce CLI installation and plug-in versions.
Run this command to verify the Salesforce CLI version:
1sfdx --version
2sfdx-cli/6.0.10-3713d7b alpha (darwin-x64) node-v8.6.0

Run this command to verify the Salesforce CLI plug-in version:

1sfdx plugins --core
2salesforcedx 41.2.0 (core)

This command returns a list of the other plug-ins installed in the CLI:

1sfdx plugins

The core salesforcedx plug-in is not included in the preceding list unless you installed a newer version with the sfdx plugins:install command.

Run this command to return a list of the command families (topics) in the force namespace:

1sfdx force --help

Run this command to view all available Salesforce CLI commands:

1sfdx commands

Install a Specific Version of the salesforcedx Plug-In

By default, the latest version of the salesforcedx plug-in is installed when you install Salesforce CLI for the first time. Sometimes, however, you want to use a specific version of the salesforcedx plug-in.

The salesforcedx plug-in v45.5.0 or earlier requires Salesforce CLI (sfdx-cli) v6. The salesforcedx plug-in v45.8.0 or later requires Salesforce CLI v7 or later.

Important

To determine which Salesforce CLI (sfdx-cli) and salesforcedx versions you have installed, run:

1sfdx plugins --core
Run this command to install a specific version of the plug-in, in this example, version 45.8.0:
1sfdx plugins:install salesforcedx@45.8.0