How to Download and Install Salesforce CLI: A 2025 Guide - Solution for Guru

Table of Contents
< All Topics
Print

How to Download and Install Salesforce CLI: A 2025 Guide

The Salesforce Command Line Interface (CLI) is an essential tool for developers and admins, simplifying tasks like managing orgs, deploying metadata, and automating workflows within Salesforce. Whether you’re building custom apps or syncing data, installing the CLI is your first step to unlocking its power. As of April 4, 2025, this guide walks you through downloading and installing the Salesforce CLI on Windows, macOS, or Linux, ensuring you’re ready to supercharge your Salesforce experience.


What Is Salesforce CLI?

Salesforce CLI is a free, open-source command-line tool that integrates with your Salesforce org. It streamlines development by letting you execute commands to create scratch orgs, deploy code, run tests, and more—all from your terminal. It’s a must-have for anyone working with Salesforce DX (Developer Experience) or seeking to automate repetitive tasks.


Prerequisites

Before you begin, ensure your system meets these requirements:

  • Operating System: Windows 10/11 (64-bit), macOS 12 or later, or a supported Linux distribution (e.g., Ubuntu 20.04+).
  • Java: JDK 11 or 17 (required for some CLI features and VS Code extensions).
  • Terminal Access: Command Prompt or PowerShell (Windows), Terminal (macOS), or a shell like Bash (Linux).
  • Internet Connection: Needed for downloading the installer.

Optional but recommended: Install Visual Studio Code and Git for a full development setup.


Step-by-Step Installation Guide

Step 1: Download Salesforce CLI

  1. Visit the Official Site: Go to the Salesforce CLI download page.
  2. Choose Your OS: Select the installer for your operating system:
    • Windows: .exe file (e.g., salesforce-windows-x64.exe).
    • macOS: .pkg file (e.g., salesforce-macos.pkg).
    • Linux: .tar.gz or .tar.xz file (e.g., salesforce-linux-x64.tar.xz).
  3. Start the Download: Click the link, and the file will save to your default downloads folder.

Step 2: Install Salesforce CLI

The installation process varies by OS—follow the steps for your system:

Windows
  1. Run the Installer: Double-click the downloaded .exe file in File Explorer.
  2. Follow Prompts: Accept the license agreement, choose an install location (default is fine), and click “Install.”
  3. Finish Up: Once complete, click “Finish.” The CLI’s sf and sfdx commands are added to your PATH automatically.
  4. Restart Terminal: Close and reopen Command Prompt or PowerShell to refresh the environment variables.
macOS
  1. Open the Package: Double-click the downloaded .pkg file in Finder.
  2. Install It: Follow the on-screen prompts, agreeing to the terms and clicking “Install.” You may need to enter your admin password.
  3. Complete Installation: Click “Close” when done. The CLI binaries are installed to /usr/local/bin.
  4. Restart Terminal: Quit and relaunch Terminal to load the CLI commands.
Linux
  1. Extract the Archive: Open a terminal, navigate to your downloads folder (cd ~/Downloads), and run: bashСвернутьПереносКопироватьtar -xvf salesforce-linux-x64.tar.xz
  2. Move Files: Copy the extracted files to a system directory, like /usr/local/bin: bashСвернутьПереносКопироватьsudo mv sfdx /usr/local/bin/ && sudo mv sf /usr/local/bin/
  3. Verify Permissions: Ensure the binaries are executable: bashСвернутьПереносКопироватьsudo chmod +x /usr/local/bin/sfdx /usr/local/bin/sf
  4. Refresh Shell: Run source ~/.bashrc (or equivalent for your shell) to update your session.

Step 3: Verify the Installation

  1. Open a Terminal: Use Command Prompt (Windows), Terminal (macOS), or your Linux shell.
  2. Check Version: Run these commands: bashСвернутьПереносКопироватьsf --version sfdx --version You should see output like sf/2.82.6 or sfdx/7.209.6, confirming the CLI is installed. (Note: sfdx is the legacy command; sf is the modern standard.)
  3. Troubleshoot: If the commands aren’t recognized, ensure the install path is in your system’s PATH variable.

Step 4: Update the CLI (Optional)

To ensure you’re on the latest version:

  1. Run: bashСвернутьПереносКопироватьsf update
  2. Wait for the update to complete. This keeps your CLI aligned with Salesforce’s latest features and fixes.

Post-Installation: First Steps

  • Authorize an Org: Connect to a Salesforce org with: bashСвернутьПереносКопироватьsf org login web --alias MyOrg This opens a browser for login, saving the org alias for future use.
  • List Commands: See all available commands with: bashСвернутьПереносКопироватьsf commands
  • Create a Project: Start a new Salesforce DX project: bashСвернутьПереносКопироватьsf project generate -n MyProject

Tips for Success

  • Set Up Java: If using VS Code extensions, install JDK 11 or 17 and set the JAVA_HOME environment variable.
  • Use a Version Control System: Pair the CLI with Git for source tracking.
  • Check Compatibility: The CLI evolves with Salesforce releases (e.g., Spring ‘25)—keep it updated.
  • Secure Access: Never share auth tokens or store them in public repositories.

Final Thoughts

Downloading and installing Salesforce CLI is a quick process that unlocks a world of efficiency for Salesforce development. Whether you’re on Windows, macOS, or Linux, these steps get you up and running in minutes. As of 2025, the CLI remains a cornerstone of Salesforce DX, empowering you to automate, deploy, and manage with ease. Ready to explore? Log in to your org and start typing commands today!