Newer Version Available

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

Install the Salesforce CLI and Plug-Ins

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.
  2. Create an sfdx directory.
  3. Unpack the contents for your tarball version:

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

  4. Run the install script.

    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:
  2. Run this command.

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

Verify Your Installation

Verify your Salesforce CLI installation and plug-in versions.
Run this command to verify the Salesforce CLI version:

Run this command to verify the salesforcedx plug-in version:

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

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:

Run this command to view all available Salesforce CLI 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.

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

The output includes all installed plug-ins. If a plug-in has (core) next to its name, it’s the version bundled with the CLI. If you install a specific version of the plug-in, its version number or tag is displayed instead.

Run this command to install a specific version of the plug-in, such as 49.14.0:

During sandbox preview, we provide a pre-release of the salesforcedx plug-in that contains updates that work only with the new features in the preview. Run this command to install the pre-release:

To install the early release candidate of the weekly salesforcedx plug-in release, run this command:

When you install a plug-in version using a tag, such as @pre-release or latest-rc, you stay with that tag until you uninstall the plug-in. To stop being tied to this release tag and go back to using the core salesforcedx plug-in that’s bundled with the CLI, run this command:

Important

Discover Salesforce Plug-Ins

After you've installed Salesforce CLI and the core salesforcedx plug-in, check out these other plug-ins that work with specific Salesforce features.
ISV Technical Enablement Plug-In
The ISVTE Plug-in is an on-demand Technical Evangelist. It scans your package metadata and code, and provides targeted feedback to help you improve and future-proof your app. The feedback includes a detailed metadata inventory, recommendations on features or technologies to consider using, enablement resources, and installation limitations. The feedback also includes best practices, partner alerts, guidance on improving your partner Trailblazer score, and more. While it's designed for ISV and OEM partners, anyone developing on the platform can use it.

When you install the plug-in, you're asked to confirm that it's unsigned. Answer yes. This behavior is expected.

See GitHub for documentation and more information.

Einstein Analytics Plug-In
Salesforce Einstein Analytics is a cloud-based platform for connecting data from multiple sources, creating interactive views of that data, and sharing those views in apps.

Use the Einstein Analytics CLI plug-in to create scratch orgs with Analytics Studio, which you can use to develop and test source code. The plug-in includes commands that call a subset of the Salesforce Analytics REST API endpoints to manage Analytics assets programmatically. Create and iteratively develop Analytics templates. Update and delete apps, dashboards, lenses, and dataflows. Use history commands to restore previous versions of dashboards and dataflows. Manage the auto-install lifecycle for embedded templated apps.

See Develop with the Analytics Plugin for the Salesforce CLI.

Install Trusted Unsigned Plug-ins Automatically

When you install a plug-in with the sfdx plugins:install command, Salesforce CLI first verifies its digital signature. If the plug-in provides a valid signature, the CLI installs it. Otherwise, Salesforce CLI doesn't install it until you answer a warning prompt and acknowledge that you understand the risks. This process works well when you install a plug-in interactively at the command line, but can prevent a batch CI/CD job from completing. To automatically install a plug-in without prompting, even when unsigned, create an allowlist file on your local file system and add the plug-ins you trust.

After you install a plug-in and run one of its commands in a terminal, the command runs with your user privileges. As a result, the command can read encrypted data, communicate with any Salesforce org you authenticated to, or remove files in your home directory. Install only unsigned and unverified plug-ins that you trust.

Warning

  1. Create a file called unsignedPluginAllowList.json and put it in one of these directories:
    • (Linux and macOS): $HOME/.config/sfdx
    • (Windows) Depending on your Windows configuration, either C:\Users\username\.config\sfdx or %LOCALAPPDATA%\sfdx
  2. Add the names of the plug-ins you trust to the JSON file in a simple array of strings. For example: