Newer Version Available

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

Install Salesforce CLI

Install the CLI on your computer using operating system-specific artifacts, such as .pkg on macOS, or with npm.

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

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

Salesforce CLI works best within the native Windows command prompt (cmd.exe) and the Microsoft Powershell. We don’t recommend using 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 with a TAR File

Salesforce CLI distributes TAR files that you can install on all supported operating systems. On Linux, the only way to install Salesforce CLI is with a TAR file.

Use this table to find the unversioned URLs for the TAR file (.tar.gz or .tar.xz ) for your operating system. When we release a new version of Salesforce CLI every week, we also update these URLs so they point to the most up-to-date version. Unversioned URLs are especially useful for CI use cases. The table also includes manifest URLs that show the versioned URL for each file.

We highly recommended that you use the installers or npm to install Salesforce CLI on Windows. If, however, you decide to use the Windows TAR files, you must first install a separate program, such as 7Zip, to extract the file contents.

Important

In these examples it’s assumed that you’re installing Salesforce CLI on Linux and in the sfdx subdirectory of your home directory.

  1. Download or wget one of these TAR files.
  2. Create the directory where you want to install Salesforce CLI.
  3. Unpack the contents for your TAR file:

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

  4. Update your PATH environment variable to include the Salesforce CLI bin directory. For example, to set it for your current terminal session:

    To update your PATH permanently, add the appropriate entry to your shell’s configuration file. For example, if you use the Bash shell, add this line to your ~/.bashrc or ~/.bash_profile file:

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 to ensure you’ve installed it correctly.
Run this command to verify the Salesforce CLI version:

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

Run this command to view all available Salesforce CLI commands: