Salesforce CLI – A Productivity Enhancer for Developers

The Salesforce CLI is a robust tool for admins also, not useful just for developers. You can use it to build and manage orgs, create and install packages, sync sources to and from orgs, and more. 

This detail is not sufficient to learn about the Salesforce CLI. 

This article will help you understand Salesforce CLI, its installation steps on different devices, its use cases, how to use it, and a lot more. 

What is Salesforce CLI?

While working with Salesforce org (the container for the entire data of Salesforce customers), a command-line interface that eases the development and craft automation is Salesforce CLI. The Salesforce CLI is also known for speeding the development process for admins and developers. It’s a free, open-source tool of Salesforce that eases and automates tasks across the platform.

Well, tech-savvy might know about CLI, but non-technical users will find it confusing. 

Simply put, a Command Line Interface is a text-based interface for developing a program. 

You should enter commands using a terminal and interact with the program to use a CLI. On a Mac, it would be a Terminal, and on Windows, it’s just Windows Terminal. 

As a text-based interface, you must type commands to accomplish your requirements. Next, these texts are processed and run by the program. These jobs are more accessible in a text-based interface than in a graphical interface. 

A CLI facilitates easy automation of any repetitive jobs. Although, the learning curve of such an interface is steeper because the visual prompts are not present.  

Install Salesforce CLI

On your computer; you can install the CLI using operating system-specific artifacts. 

You can choose one method mentioned below on your computer. 

1. Install the CLI on macOS

You can install Salesforce CLI on macOS using a .pkg file. 

Steps to Follow:

  • Download the .pkg file.
  • Run the .pkg file, like double-clicking it from Finder, and reply to all the prompts. (Installation ends here.)
  • Next, restart your IDEs or Terminal windows to ensure the Salesforce CLI executables are now available. 

Note: The macOS installer installs the sfdx and sf executables. 

2. Install the CLI on Windows

You can install Salesforce CLI on Windows using a .exe file. 

Steps to Follow:

  • Download the .exe file.
  • Run the .exe file, like double-clicking it from Windows Explorer, and reply to all the prompts. (Installation ends here.)
  • Next, restart your PowerShell windows, command prompts, or IDEs to ensure the Salesforce CLI executables are now available. 

Note: The Windows installer installs the sfdx and sf executables. 

Warning by Salesforce

Salesforce CLI performs at its best within the native Windows command prompt (cmd.exe) and Microsoft Windows PowerShell. It’s not recommended to use Salesforce CLI with a Linux terminal emulator, like Windows 10 Subsystem for Linux, MinGW, or Cygwin, as bug support is limited. 

3. Install the CLI with a TAR File

Salesforce CLI offers TAR files that one can install on all the supported operating systems. On Linux, you can install Salesforce CLI in just one way, with a TAR file. 

You can use the below table to emerge with the unversioned URLs for the TAR file (.tar.xz or .tar.gz) for your OS. When Salesforce releases a new version of Salesforce CLI each week, they update these URLs also. This way, they are always ready with the latest version. 

Universal URLs are specifically best for CLI use cases. 

The below table contains manifest URLs that reveal the versioned URL for every line.

Operating SystemTar FilesManifest

4. Install the CLI with npm

You can use npm to install Salesforce CLI if you have already installed Node.js on your computer. This method will let you install Salesforce CLI from the command line and can be specifically useful for continuous integration (CI) use cases. 

You can follow this method to install CLI if:

  • You don’t have administrator permissions on your workstation or
  • Group policy blocks the CLI installation and updates. 

Installing the CLI with npm doesn’t need root permissions. 

Steps to Follow

Be sure Node.js’s long-term support (Active LTS) version is installed on your computer. 

  • To install the LTS version, jump to 

Noderjs.Org Download

  • Run: 

node –version (to check your version number)

  • Run: 
npm install sfdx-cli --global (to install the sfdx executable)
  • Run:
npm install @salesforce/cli --global (to install the sf executable)

When installing the CLI using npm, if you get a permission error, it’s recommended not to use sudu. 

5. Install Older Versions of Salesforce CLI

It’s recommended that you can use Salesforce CLI’s release candidate or the latest version. 

Obviously, you may sometimes need an older version of the CLI. So, for that, Salesforce publishes JSON files that list the download URLs for the installers’ and Tar files’ latest versions for every supported OS. 

Every week, Salesforce adds a recently released version to the list; the version stays on the list for about 20 weeks. They keep the TAR and installer files for a minimum of 40 weeks. 

Note: Salesforce will keep each old version of the sfdx-cli npm package.

6. Verify Your Installation

To check if you have correctly installed the Salesforce CLI installation, you need to verify it. 

Steps to Follow

  • Run the below command to verify the version you installed:
sfdx --version
sfdx-cli/7.144.0 darwin-x64 node-v16.14.2
  • Next, run the below command to see the installed plugins and their versions. 
sfdx plugins --core

@oclif/plugin-autocomplete 0.3.0 (core)
@oclif/plugin-commands 1.3.0 (core)
@oclif/plugin-help 3.3.1 (core)
@oclif/plugin-not-found 1.2.6 (core)
@oclif/plugin-plugins 1.10.11 (core)
@oclif/plugin-update 1.5.0 (core)
@oclif/plugin-warn-if-update-available 2.0.4 (core)
@oclif/plugin-which 1.0.4 (core)
@salesforce/sfdx-plugin-lwc-test 0.1.7 (core)
alias 1.2.1 (core)
apex 0.11.0 (core)
auth 1.8.1 (core)
community 1.1.4 (core)
config 1.3.23 (core)
custom-metadata 1.0.12 (core)
data 0.6.10 (core)
generator 1.2.2 (core)
info 1.3.1 (core)
limits 1.3.0 (core)
org 1.11.2 (core)
salesforce-alm 54.0.2 (core)
schema 1.1.0 (core)
sfdx-cli 7.144.0 (core)
source 1.9.0 (core)
telemetry 1.4.0 (core)
templates 54.3.0 (core)
user 1.7.1 (core)
  • Run the below command to show your current Salesforce CLI version’s release notes:
sfdx whatsnew

Uses of Salesforce CLI

You can use Salesforce CLI as follows:

  • It helps accumulate essential tools needed for the development and perform commands. 
  • You can use it to create and install packages. 
  • Users can use it to create and execute tests.
  • You can sync sources to and from scratch organizations. 
  • Export and import data.
  • Also, to create and manage organizations. 

3 Ways to Use the Salesforce CLI

Let’s check out some real-life scenarios and use-cases where one can use the Salesforce CLI to increase efficiency. 

1. Retrieve and Deploy Metadata

Let’s take a scenario to understand it better.

Suppose you are a Salesforce Consultant. Recently, you have accomplished a project including a flow creation enclosed in the utility bar. The aim was to facilitate end users to raise cases and requests for assistance rapidly. 

You achieved the user testing and deployed it using changesets from the testing environment to the production. 

Later, a similar scenario appeared in another project after a few weeks with some minute differences. Despite redeveloping the same feature again, you choose to use the Salesforce CLI to stimulate this feature by deploying your known, tried-and-tested solution for the previous org before changing it to fulfill the client’s specific requirements. 

2. Import and Export Data

In this case, you have a UAT environment running on a partial copy sandbox. 

You have developed a perfect set of test accounts and contact that you want to move from partial copy into various new development sandboxes. 

Although the sandbox types are different, you can’t only build a new sandbox using the UAT environment as your source. 

You could export the data and then import it to your development sandboxes. But, you will need to perform with VLOOKUPS or external IDs within Excel each time. It’s not scalable and also not easy. 

So, you can use the Salesforce CLI to speed up things and make them scalable. 

3. Sandbox Creation

The CLI includes the

force:org:create command

that’s used to create scratch orgs. 

You can use it to create sandboxes, also. And for that, you should use various parameters chiefly defined as key-value pairs within your command.


Hopefully, you find this post helpful to learn about Salesforce CLI and use it to streamline your jobs. 

You can connect with a Salesforce consultant to get more details and speed up your development process. 

Avatar photo

With a decade of experience in eCommerce technologies and CRM solutions, Virendra has been assisting businesses across the globe to harness the capabilities of information technology by developing, maintaining, and improving clients’ IT infrastructure and applications. A leader in his own rights his teammates see him as an avid researcher and a tech evangelist. To know how the team Virendra can assist your business to adopt modern technologies to simplify business processes and enhance productivity. Let’s Talk.