By using this site, you agree to the Privacy Policy and Terms of Use.
Accept
horizontal-light horizontal-dark
  • Tutorials
    • Salesforce Flow
    • Salesforce Integration
    • Salesforce Tools
    • Apex Development
    • Lightning Web Components
    • AI and Automation
    • Salesforce Errors
    • DevOps and Deployment
  • Interview Questions
    • Salesforce Developer Interview Questions
  • Career & Certification
    • Salesforce Certification Guide 2026
  • More
    • Privacy Policy
    • Disclaimer
    • Terms & Conditions
    • Contact
SalesforceCornerSalesforceCorner
Search
  • Tutorials
    • Salesforce Flow
    • Salesforce Integration
    • Salesforce Tools
    • Apex Development
    • Lightning Web Components
    • AI and Automation
    • Salesforce Errors
    • DevOps and Deployment
  • Interview Questions
    • Salesforce Developer Interview Questions
  • Career & Certification
    • Salesforce Certification Guide 2026
  • More
    • Privacy Policy
    • Disclaimer
    • Terms & Conditions
    • Contact
Follow US
Home » Salesforce CLI Install Guide: Windows, Mac & Linux Step-by-Step
Salesforce Tools

Salesforce CLI Install Guide: Windows, Mac & Linux Step-by-Step

Learn how to install Salesforce CLI, authorize orgs, manage metadata, and use CLI commands for modern Salesforce development workflows.

Neha Panwar
By
Neha Panwar
ByNeha Panwar
Salesforce Developer and Technical Writer
Neha Panwar is a Salesforce developer and technical writer who shares practical tutorials, Apex guides, and real-world solutions for developers. She focuses on simplifying Salesforce concepts,...
Follow:
- Salesforce Developer and Technical Writer
Last updated: 2026/06/08
Share
Salesforce CLI installation and setup
SHARE

Salesforce CLI Installation and Setup Guide is one of the most important topics for anyone learning modern Salesforce development.

Because today, almost every professional Salesforce development workflow depends on Salesforce CLI.

Whether you are:

  • deploying metadata
  • authorizing orgs
  • retrieving components
  • managing projects
  • creating scratch orgs
  • working with Salesforce DX

Salesforce CLI becomes essential.

And honestly, once developers become comfortable with CLI workflows, productivity improves significantly.

I still remember when most Salesforce deployments were done manually using changesets. Modern Salesforce development is very different now. Salesforce CLI has completely changed how developers manage projects and deployments.

In this guide, we will understand:

  • What Salesforce CLI is
  • How to install Salesforce CLI
  • Windows setup
  • macOS setup
  • Linux setup
  • CLI verification
  • Org authorization
  • Common commands
  • Troubleshooting errors
  • Best practices

By the end of this article, you will have Salesforce CLI fully configured and ready for development work.

Contents
What is Salesforce CLI?Why Salesforce Developers Use Salesforce CLIDifference Between sf and sfdx CommandsPrerequisites Before Installing Salesforce CLIInstall Salesforce CLI on WindowsStep 1: Download InstallerStep 2: Run InstallerStep 3: Restart TerminalInstall Salesforce CLI on macOSStep 1: Download .pkg FileStep 2: Run InstallerStep 3: Restart TerminalInstall Salesforce CLI on LinuxTAR Installation ExampleInstall Salesforce CLI Using npmVerify Salesforce CLI InstallationView Installed CLI PluginsView Available CommandsAuthorize Salesforce Org Using CLIList Authorized OrgsSet Default OrgCreate Salesforce DX ProjectRetrieve Metadata Using Salesforce CLIDeploy Metadata Using Salesforce CLISalesforce CLI Integration with VS CodeSalesforce CLI vs WorkbenchWorkbenchSalesforce CLISalesforce CLI vs Developer ConsoleDeveloper ConsoleSalesforce CLICommon Beginner ErrorsCLI Not RecognizedAuthentication Failuresnpm Permission ErrorsDeployment ErrorsMixing sf and sfdx CommandsWhat I Have Seen in Real Salesforce ProjectsBest Practices for Salesforce CLIUse Latest CLI VersionLearn Core Commands FirstAvoid Direct Production DeploymentsKeep VS Code IntegratedLearn Git Alongside CLIWhy Salesforce CLI Matters for Salesforce CareersFAQWhat is Salesforce CLI used for?Is Salesforce CLI free?What is the difference between sf and sfdx?Can admins use Salesforce CLI?Do I need Salesforce CLI for VS Code?

What is Salesforce CLI?

Salesforce CLI stands for Salesforce Command Line Interface.

It is a command line tool used by Salesforce developers and admins to interact with Salesforce orgs directly from the terminal.

Instead of performing everything manually inside Salesforce UI, developers can execute commands for:

  • deployments
  • metadata retrieval
  • org management
  • automation
  • testing
  • authentication

Salesforce CLI is heavily integrated with:

  • VS Code
  • Salesforce DX
  • CI/CD pipelines
  • Git workflows

Why Salesforce Developers Use Salesforce CLI

Modern Salesforce projects often involve:

  • multiple developers
  • deployment pipelines
  • source control
  • automated testing
  • scratch orgs

Manual workflows become difficult very quickly.

That is why Salesforce CLI is important.

It helps developers:

  • automate repetitive tasks
  • deploy faster
  • retrieve metadata efficiently
  • manage org connections
  • improve development speed

Salesforce officially recommends Salesforce CLI for modern Salesforce Development workflows.

Difference Between sf and sfdx Commands

This is one of the biggest beginner confusions.

Older Salesforce CLI versions used:

sfdx

Modern Salesforce CLI now primarily uses:

sf

Example:

Old command:

sfdx force:org:list

Modern command:

sf org list

Salesforce now recommends using sf commands because they are simpler and cleaner.

However, many older tutorials still use sfdx.

So beginners should understand both.

Prerequisites Before Installing Salesforce CLI

Before starting Salesforce CLI Installation and Setup Guide, make sure:

  • internet connection is stable
  • terminal or command prompt works correctly
  • administrator permissions are available
  • Node.js is optionally installed

Node.js becomes useful for:

  • npm installations
  • Lightning Web Components
  • frontend tooling

Install Salesforce CLI on Windows

Installing Salesforce CLI on Windows is straightforward.

Step 1: Download Installer

Download the Windows installer from Salesforce official website.

Usually:

  • Windows x64 installer
  • .exe file

Step 2: Run Installer

Double click installer and follow setup instructions.

During installation:

  • accept permissions
  • complete installation prompts
  • allow PATH configuration

Step 3: Restart Terminal

After installation:

  • close terminal
  • reopen Command Prompt or PowerShell

This ensures PATH variables refresh properly.

Install Salesforce CLI on macOS

macOS installation is also simple.

Step 1: Download .pkg File

Download:

  • Apple Silicon version
  • Intel version

depending on your Mac processor.

Step 2: Run Installer

Open the .pkg file and complete installation.

Step 3: Restart Terminal

Restart terminal or VS Code after installation completes.

Install Salesforce CLI on Linux

Linux users can install Salesforce CLI using TAR files or npm.

TAR Installation Example

Download TAR file:

wget https://developer.salesforce.com/media/salesforce-cli/sf/channels/stable/sf-linux-x64.tar.xz

Extract files:

tar xJf sf-linux-x64.tar.xz

Update PATH variable properly.

Linux setup usually requires slightly more terminal familiarity.

Install Salesforce CLI Using npm

Some developers prefer npm installation.

First verify Node.js:

node --version

Then install CLI:

npm install @salesforce/cli --global

This method is especially common in CI/CD environments.

Verify Salesforce CLI Installation

After installation, verify setup using:

sf --version

Successful output looks similar to:

@salesforce/cli/2.x.x

If version appears correctly, installation succeeded.

View Installed CLI Plugins

You can also inspect installed plugins:

sf plugins --core

This displays:

  • auth plugins
  • org plugins
  • deployment plugins
  • Apex tools
  • packaging tools

View Available Commands

To list all commands:

sf commands

This becomes useful while learning CLI capabilities.

Authorize Salesforce Org Using CLI

Now let’s connect Salesforce CLI with your org.

Run:

sf org login web

Browser opens automatically.

After login:

  • org becomes authorized
  • CLI can interact with Salesforce
  • deployments become possible

This is one of the most important Salesforce CLI workflows.

List Authorized Orgs

To view connected orgs:

sf org list

This command helps developers manage multiple environments.

Set Default Org

To set default org:

sf config set target-org=myOrgAlias

This avoids repeatedly specifying org names during deployments.

Create Salesforce DX Project

Generate project:

sf project generate

This creates:

  • project structure
  • metadata folders
  • manifest files
  • configuration settings

Modern Salesforce development heavily depends on Salesforce DX projects.

Retrieve Metadata Using Salesforce CLI

Retrieve metadata from org:

sf project retrieve start

Developers use this constantly during:

  • debugging
  • feature development
  • deployments
  • project synchronization

Deploy Metadata Using Salesforce CLI

Deploy source to org:

sf project deploy start

This is one of the most commonly used commands in real Salesforce projects.

Salesforce CLI Integration with VS Code

Salesforce CLI works extremely well with VS Code.

In fact, most VS Code Salesforce operations internally use Salesforce CLI commands.

If you have not yet configured VS Code properly, our VS Code Setup for Salesforce Development guide explains the complete setup process including extensions, org authorization, and deployments.

Salesforce CLI vs Workbench

Beginners often compare CLI with Workbench.

Workbench

Best for:

  • quick API testing
  • SOQL queries
  • metadata inspection
  • data export

Salesforce CLI

Best for:

  • deployments
  • automation
  • source control workflows
  • Salesforce DX projects
  • CI/CD pipelines

Both tools are useful but serve different purposes.

Our Salesforce Salesforce Workbench Tutorial for Beginners how admins and developers use Workbench for APIs, metadata, and queries.

Salesforce CLI vs Developer Console

Another common beginner question.

Developer Console

Best for:

  • quick Apex execution
  • debug logs
  • SOQL queries
  • troubleshooting

Salesforce CLI

Best for:

  • deployments
  • project management
  • automation
  • metadata operations

Modern teams often use both tools together.

Our Salesforce Developer Console Tutorial for Beginners explains how developers use Execute Anonymous, logs, and debugging workflows inside Salesforce.

Common Beginner Errors

After helping beginners setup Salesforce CLI, I repeatedly notice these issues.

CLI Not Recognized

Usually caused by:

  • PATH variable problems
  • incomplete installation
  • terminal not restarted

Authentication Failures

Common reasons:

  • expired sessions
  • blocked browser login
  • incorrect environment selection

npm Permission Errors

Mostly happens on:

  • macOS
  • Linux

Avoid using sudo unnecessarily.

Deployment Errors

Often caused by:

  • missing metadata
  • API version mismatch
  • dependency issues

Mixing sf and sfdx Commands

This confuses many beginners because older tutorials still use sfdx.

Modern Salesforce development mainly uses sf.

What I Have Seen in Real Salesforce Projects

One thing I consistently notice is that developers who understand Salesforce CLI early become much more efficient later.

Because eventually real Salesforce projects require:

  • deployments
  • Git workflows
  • CI/CD
  • automation
  • metadata retrieval
  • org management

Without Salesforce CLI knowledge, these workflows become difficult.

Modern Salesforce development is no longer only browser based development.

CLI skills are now part of the standard developer workflow.

Best Practices for Salesforce CLI

Here are some practical recommendations.

Use Latest CLI Version

Salesforce frequently updates CLI features.

Older versions may cause compatibility issues.

Learn Core Commands First

Start with:

  • org login
  • org list
  • retrieve
  • deploy
  • project generate

Then gradually learn advanced commands.

Avoid Direct Production Deployments

Always test deployments in Sandbox first.

Keep VS Code Integrated

VS Code + Salesforce CLI together create a much smoother development experience.

Learn Git Alongside CLI

CLI workflows become even more powerful with Git version control.

Why Salesforce CLI Matters for Salesforce Careers

Once beginners complete Salesforce CLI Installation and Setup Guide properly, Salesforce development starts feeling much more professional.

Because now you understand:

  • command based workflows
  • metadata deployments
  • Salesforce DX
  • org management
  • automation workflows
  • modern development practices

And honestly, almost every advanced Salesforce development topic later depends on CLI knowledge.

FAQ

What is Salesforce CLI used for?

Salesforce CLI is used for deployments, metadata retrieval, org authorization, project creation, automation, and Salesforce DX development workflows.

Is Salesforce CLI free?

Yes, Salesforce CLI is completely free and officially provided by Salesforce for development and administration tasks.

What is the difference between sf and sfdx?

sfdx is the older command format while sf is the newer modern Salesforce CLI command structure recommended by Salesforce.

Can admins use Salesforce CLI?

Yes. Salesforce admins can use CLI for metadata management, org administration, automation, and deployments.

Do I need Salesforce CLI for VS Code?

Yes. Most Salesforce VS Code features depend on Salesforce CLI integration for deployments, org connections, and metadata operations.

TAGGED:Salesforce CLISalesforce CLI CommandsSalesforce DeploymentSalesforce DevelopmentSalesforce DXSalesforce Setupsalesforce toolsVS Code Salesforce
Share This Article
Facebook Email Print
ByNeha Panwar
Salesforce Developer and Technical Writer
Follow:
Neha Panwar is a Salesforce developer and technical writer who shares practical tutorials, Apex guides, and real-world solutions for developers. She focuses on simplifying Salesforce concepts, integrations, and backend development to help beginners and professionals learn faster.
Leave a Comment Leave a Comment

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Latest Post

How to Show a Toast Message in Salesforce LWC
Uncategorized
Fix unable to lock row error
How to Fix UNABLE_TO_LOCK_ROW Error in Salesforce
Salesforce Errors
How to fix SOQL 101 error
How to Fix Too Many SOQL Queries: 101 Error in Salesforce
Salesforce Errors
How to create a Lightning Web component
How to Create Your First Lightning Web Component in Salesforce
Lightning Web Components
Salesforce access management infographic
When Should You Use Permission Sets Instead of Profiles in Salesforce?
Salesforce Admin

Stay Updated with Salesforce Tutorials

Get the latest Salesforce guides, tutorials, and developer tips delivered to your inbox.
slaesforce corner mascot

Explore More Topics

  • salesforce developer
  • salesforce admin
  • salesforce tutorial
  • Salesforce Development
  • Salesforce Admin
  • salesforce security
  • Salesforce Tools
  • Salesforce Tutorials
  • Salesforce Beginner Guide
  • lightning web components
  • salesforce automation
  • Lightning Web Components
  • salesforce apex
  • salesforce lwc
  • Apex Development
horizontal-dark-transparent

Learn Salesforce development with practical tutorials, Apex guides, integration examples, and real-world solutions for developers.

  • Quick Links:
  • About
  • Contact
  • Privacy Policy
  • Disclaimer
  • Terms & Conditions
Facebook Twitter Youtube Linkedin-in

Salesforce Corner © 2026

Welcome Back!

Sign in to your account

Username or Email Address
Password

Lost your password?