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.

Choose one method to install on your computer. For example, don’t install on macOs with both a .pkg and npm.

Install the CLI on macOS

You install Salesforce CLI on macOS with a .pkg file.

The macOS installer installs both the sfdx and sf executables.

Note

  1. Download the .pkg file.
  2. Run the .pkg file, such as double-clicking it from Finder, and answer all the prompts.
  3. After the installation completes, restart your Terminal windows or IDEs to make sure the Salesforce CLI executables are available.

Install the CLI on Windows

Install Salesforce CLI on Windows with an .exe file.

The Windows .exe installer installs both the sfdx and sf executables.

Note

  1. Download the .exe file.
  2. Run the .exe file, such as double-clicking it from Windows Explorer, and answer all the prompts.
  3. After the installation completes, restart your command prompts, PowerShell windows, or IDEs to make sure the Salesforce CLI executables are available.

Salesforce CLI works best within the native Windows command prompt (cmd.exe) and the Microsoft Windows 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.

These TAR files bundle the sfdx and sf executables together.

Note

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.

    This example shows just one possible set of flags for the tar command on Linux. For other options on your operating system, refer to the tar documentation.

    Note

  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.

When installing Salesforce CLI with npm, you install the sfdx and sf executables separately using the commands shown in the following steps. In contrast, the Salesforce CLI installers and TAR files bundle the two executables together.

Note

  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 to install the sfdx executable.
    Run this command to install the sf executable.
    If you receive a permission error when installing the CLI using npm, we recommend not using sudo. See Fixing npm permissions.

Install Older Versions of Salesforce CLI

We recommend that you always use the latest version or release candidate of Salesforce CLI. However, we also understand that sometimes you might require an older version of the CLI. For these use cases, we publish JSON files that list the download URLs for recent versions of the installers and TAR files for each supported operating system.
Each week we add the latest released version to the lists; versions remain on the list for 20 weeks. We keep the TAR and installer files themselves for 40 weeks minimum.

We continue to keep all old versions of the sfdx-cli npm package.

Note

Operating System File Type TAR Compression Type Link to JSON File
Linux ARM TAR gz sfdx-linux-arm-tar-gz.json
Linux ARM TAR xz sfdx-linux-arm-tar-xz.json
Linux 64 TAR gz sfdx-linux-x64-tar-gz.json
Linux 64 TAR xz sfdx-linux-x64-tar-xz.json
Windows 64 TAR gz sfdx-win32-x64-tar-gz.json
Windows 64 TAR xz sfdx-win32-x64-tar-xz.json
Windows x86 TAR gz sfdx-win32-x86-tar-gz.json
Windows x86 TAR xz sfdx-win32-x86-tar-xz.json
macOS TAR gz sfdx-darwin-x64-tar-gz.json
macOS TAR xz sfdx-darwin-x64-tar-xz.json
Windows 64 Installer sfdx-x64-exe.json
Windows x86 Installer sfdx-x86-exe.json
macOS Installer sfdx-pkg.json

Verify Your Installation

Verify your Salesforce CLI installation to ensure you’ve installed it correctly.
Run this command to verify the Salesforce CLI version:

Run this command to view the installed plug-ins and their versions:

Run this command to view all available Salesforce CLI commands:

Run this command to display the release notes for your current Salesforce CLI version: