Modern Salesforce development relies heavily on "source-driven development." This means you write and test code on your local computer before pushing it to a scratch org or sandbox. Setting up this workspace from scratch is a rite of passage for every Salesforce developer. Here is your ultimate, updated guide to getting your machine ready.
Key Points Summary
- The in-browser Developer Console is outdated and does not support Lightning Web Components (LWC). You must use a local IDE.
- Visual Studio Code (VS Code) is the only officially supported IDE by Salesforce.
- Salesforce has shifted from the old
sfdxCLI to the modern, fastersfCLI. - You must install Java (JDK 17 or JDK 21) because the Apex Language Server relies on it to read and highlight your code.
Step 1: Install & Configure Java (JDK 17 or 21)
The Salesforce Extension Pack in VS Code uses a background tool called the Apex Language Server. This tool provides auto-completion, syntax checking, and inline error highlighting for Apex code. Because this server is built on Java, you must install the Java Development Kit (JDK).
- Download the JDK: Salesforce currently recommends JDK 17 or JDK 21 (JDK 11 is now deprecated). Download a supported distribution from the Oracle website or use an open-source alternative like Adoptium.
- Configure the Environment Variable (Windows):
- Right-click the Start Menu and select System, then click Advanced system settings.
- Click Environment Variables at the bottom.
- Under System variables, click New... and name the variable
JAVA_HOME. - Paste the folder path of your installed JDK (e.g.,
C:\Program Files\Java\jdk-17) into the value field and click OK.
Open a fresh Command Prompt (Windows) or Terminal (Mac), type
java --version, and press Enter. If configured correctly, your terminal will spit back the installed Java version.
If your terminal returns an error saying
'javac' is not recognized as an internal or external command, your system does not know where Java is installed. Double-check your JAVA_HOME path and ensure you added %JAVA_HOME%\bin to your system's main Path environment variable.
Step 2: Install the Modern Salesforce CLI
The Salesforce Command Line Interface (CLI) is the bridge between your local computer and your Salesforce orgs. It allows you to download metadata, deploy code, generate test classes, and authenticate into sandboxes.
- Download the installer from the official Salesforce CLI page.
- Run the installer and accept all the default installation prompts.
- Verify the installation by opening your terminal and typing
sf --version. (Note: The modern command issf, which has replaced the oldersfdx).
Step 3: Install Visual Studio Code
Visual Studio Code (VS Code) is Microsoft's free, lightweight code editor. It is the gold standard for Salesforce development.
- Download the appropriate version for your operating system from code.visualstudio.com.
- Run the executable and complete the straightforward installation wizard.
Step 4: Install the Salesforce Extension Pack
VS Code is just a generic text editor until you add plugins. The official Salesforce Extension Pack supercharges the editor with tools specifically designed for Apex, LWC, SOQL, and Visualforce.
- Launch Visual Studio Code.
- Click the Extensions icon on the far-left sidebar (or press
Ctrl+Shift+Xon Windows /Cmd+Shift+Xon Mac). - Search for Salesforce Extension Pack.
- Click Install. This will automatically bundle and install multiple extensions, including the Apex Replay Debugger and LWC language services.
Frequently Asked Questions (FAQ)
A: While third-party plugins exist for other IDEs (like Illuminated Cloud for IntelliJ), VS Code is the only IDE officially supported and continuously updated by Salesforce. Using VS Code ensures you always have access to the latest LWC tooling and CLI integrations.
A: The in-browser Developer Console is fine for running quick SOQL queries or writing a fast Anonymous Apex script. However, it cannot be used to build Lightning Web Components (LWC). Furthermore, it lacks modern features like version control (Git) integration and advanced code linting.
A: sfdx was the original Salesforce CLI command structure. Recently, Salesforce completely rebuilt the CLI to be faster and more intuitive, rebranding the primary command to sf. While most sfdx commands still work as aliases, you should train yourself to use the modern sf commands.
- Java (JDK 17/21): Required under the hood to power the Apex language intelligence and syntax parsing.
- Salesforce CLI (
sf): The terminal tool that pushes and pulls code between your computer and Salesforce orgs. - VS Code: The visual text editor where you write your code.
- Extension Pack: The plugin that connects VS Code to the Salesforce CLI, giving you point-and-click deployment menus.
Ctrl+Shift+P (or Cmd+Shift+P) inside VS Code and type "SFDX: Create Project" to generate your first local workspace!