The Salesforce CLI is the free tool behind half the clever things you have seen people do with Claude and Salesforce, and its name scares off most admins. You don’t need to code to set it up. One installer, one login, and a couple of commands to prove it worked.
On this page
Admins click. The CLI types.
Everything you do in Setup by clicking, the Salesforce CLI can do by typing a command. That sounds like a developer thing, and for years it mostly was.
Then AI showed up. Claude is very good at writing and running Salesforce CLI commands, which means an admin who has the CLI set up can ask for a validation rule, a permission set change or a record count in plain English and let Claude do the typing. An admin who doesn’t have it set up gets a lovely command pasted into the chat and the job of running it themselves.
This post is the setup, and only the setup: install the CLI, log it in to one Salesforce org, and check that the two are talking. No code, no config files, and nothing gets installed in Salesforce. The fun stuff comes after.
Four things, and you probably have three.
Each of these has stopped someone halfway through setup, usually right before a meeting.
- Permission to install software on your computer. Most personal Macs are fine. On a company laptop, especially a Windows one, you may need IT to run the installer for you or give you temporary admin rights. Ask before you start.
- A sandbox and a user that can log in to it. Use your normal admin user. It needs the API Enabled permission, which the System Administrator profile already has. A Developer Edition org works too if you want a playground.
- The sandbox’s login address, if the org uses single sign-on. Most sandboxes log in at
test.salesforce.com. If you normally use a company login page, copy that address. It usually ends in.sandbox.my.salesforce.com. - A nickname for the org. Use client-environment, lowercase with dashes and no spaces. This guide uses
acme-dev.
Do I need Node.js, Git or VS Code?
No. You might see those in developer guides. The Salesforce CLI installer brings everything it needs, so for this setup you install exactly one thing. You also don’t need to know any code. You will type about six commands, and every one of them is on this page for you to copy.
Install the Salesforce CLI.
Download the installer that matches your computer and click through it like any other app.
Go to the Salesforce CLI download page and scroll to Choose your operating system. There are two installers each for macOS and Windows, so first work out which one is yours.

Apple Silicon or Intel?
Click the Apple menu, then About This Mac. “Chip: Apple M…” means Download for macOS (Apple Silicon). “Processor: Intel…” means Download for macOS (Intel CPU).

Open the .pkg file it downloads and click Continue through the installer. When you see the green check mark, click Close.

x64 or ARM64?
Open Settings > System > About and look at System type. Most PCs say “x64-based,” which means Download for Windows x64. If yours says “ARM-based,” use Download for Windows ARM64. Run the installer it downloads and click through.
Windows screenshots coming soon.
Installer asking for a password you don’t have? That is your computer’s admin password, not a Salesforce one. On a company laptop, this is the moment to message IT.
Check that it installed.
Open a terminal and ask the CLI what version it is. If it answers, you are in business.
A terminal is the window where you type commands. Open a fresh one after the installer finishes, because a terminal only notices programs that were installed before it opened.
| Mac | Windows | |
|---|---|---|
| Use | Terminal | Command Prompt (not PowerShell) |
| To open it | Press Command + Space, type Terminal, press Return | Click Start, type cmd, open Command Prompt |
| If it was already open | Quit it with Command + Q and reopen it | Close the window and open a new one |
Type this and press Return (Mac) or Enter (Windows):
sf --version
What you should see: a line starting with @salesforce/cli/2. followed by more numbers. The first run can take 20 seconds or so while the CLI gets itself together. Patience.

node-v24 part is the CLI’s own built-in copy of Node, not something you had to install.See a yellow Warning: @salesforce/cli update available line above the version, like the one in the screenshot? That isn’t an error. Salesforce releases a new CLI version almost every week, so the installer is often a version or two behind by the time you run it. Ignore it for now, or run sf update to catch up.
Windows screenshots coming soon.
Why not PowerShell? PowerShell can block some commands with a “running scripts is disabled on this system” error. Command Prompt doesn’t have that problem, so use it for everything in this guide.
Log the CLI in to your org.
One command opens a normal Salesforce login page. You log in, click Allow, and the CLI remembers that org under the nickname you gave it.
Pick the login address for the kind of org you are connecting:
| Connecting a | Use this --instance-url |
|---|---|
| Sandbox | https://test.salesforce.com |
| Production or Developer Edition org | https://login.salesforce.com |
| Org with single sign-on or a custom login page | That org’s My Domain address, such as https://acme--dev.sandbox.my.salesforce.com |
For Acme’s dev sandbox, the command is this, on a Mac or a PC:
sf org login web --alias acme-dev --instance-url https://test.salesforce.com

--alias is the nickname. It is how you, and later Claude, tell the CLI which org you mean. It doesn’t matter which folder your terminal is in when you run this, because the CLI saves logins for your whole computer.
A browser window opens on the Salesforce login page. Log in with your sandbox username, which usually ends in the sandbox name, like you@acme.com.dev.

test.salesforce.com did its job. If your org uses single sign-on, Use Custom Domain is the way through.Salesforce then asks whether the Salesforce CLI can have access. Click Allow.

Go back to the terminal and wait for the success message.
What you should see: Successfully authorized you@acme.com.dev with org ID 00D…

abc-dev, so yours will show whatever you typed after --alias. Every org ID starts with 00D.The most common mistake here is logging in to the wrong org, and it usually isn’t your fault. The browser happily reuses whatever Salesforce session it already has open. Log out of Salesforce in that browser (or use a private window), then run the same command again. The new login replaces the wrong one.
Connecting production? You can, with https://login.salesforce.com and a nickname ending in -prod. Once it is connected, every command that names it runs in the live org. Start with a sandbox while you learn.
Prove the CLI can talk to Salesforce.
Three quick commands: see the org in your list, open it, and ask it a question.
First, the list of orgs the CLI knows about:
sf org list
You should see acme-dev in the table next to your username.
Next, open the org straight from the CLI. If Setup opens in the sandbox you expected, the nickname points at the right place.
sf org open --target-org acme-dev
Last, a real question. This counts the Accounts in the sandbox, and it only reads data, so it can’t break anything:
sf data query --query "SELECT COUNT() FROM Account" --target-org acme-dev
What you should see: Total number of records retrieved: followed by a number. Any number is fine, including zero in an empty Developer Edition org. If you got a number, the CLI is installed, logged in and talking to Salesforce. Go tell someone.
You have a working CLI. Now use it.
The hard part was the one-time setup, and it is done. Here is where to go from here.
- 1
Add your other orgs
Every extra sandbox, production org or Developer Edition org is the same login command with a different nickname. The quick guide to adding another org to the CLI covers that, plus sandbox refreshes, renaming a nickname and logging out when a project ends.
- 2
Keep the CLI updated
Salesforce updates the CLI often. Every month or so, run
sf updatein a terminal to get the latest version. It is the same command on a Mac and a PC. - 3
Hand the typing to Claude
With the CLI logged in, Claude can run these commands for you and handle the setup work you would normally click through. That is the next part of this series.
The things that go wrong, and the fixes.
command not found: sf, or ‘sf’ is not recognized
It says an update is available
sf update whenever you have a minute, or ignore it. Everything in this guide works either way.The installer wants an admin password I don’t have
Windows says running scripts is disabled on this system
cmd) and run the same command.It logged me in to the wrong org
No browser opened, or the wrong login page opened
--instance-url: test.salesforce.com for sandboxes, login.salesforce.com for production and Developer Edition, or the org’s own My Domain address if it uses single sign-on.The terminal just sits there after I log in
sf org list. If your nickname is in the list, the login worked. If it isn’t, run the login command again.The query says it can’t find my org
--target-org has to match sf org list exactly, dashes and all. If it matches and still fails, the login has probably expired, which happens when a sandbox gets refreshed. Run the login command again with the same nickname.How do I log out?
sf org logout --target-org acme-dev with your org’s nickname, then type y when it asks if you are sure. The guide to adding and removing orgs walks through it with a screenshot, plus how to log out of every org at once.Is this safe to run against a client’s org?
Fifteen minutes now, a lot less clicking later.
The Salesforce CLI is free and comes straight from Salesforce. Install it, log in once, and it is ready whenever you are.
Know an admin who still thinks the CLI is just for developers?
Share on LinkedIn