Salesforce DX allows developers to create Scratch Orgs, these scratch Orgs are the used to build an application using Source-driven development. As per Source-driven development, Source code is stored in Version Control systems (VCS).

Salesforce Dev Hub Setup

To create Scratch Orgs, enable Dev Hub in our Salesforce organisation, download & Install Salesforce DX CLI and configure Salesforce Dev Hub setup.

  • By enabling Dev Hub in Salesforce, we can create and manage Scratch Orgs from command line.
  • We can view Scratch Org information and link namespace Orgs.

Enabling Salesforce Dev Hub

Following the steps given below.

Salesforce Dev Hub Setup
  • Click on enable, to enable Dev Hub and also enable unlocked packages and second generation managed packages to develop 2GP packages.
Enable Dev Hub in Salesforce Org
  • Enable packaging to develop and distribute unlocked packages for salesforce customers.
  • To develop and distribute second-generation manages packages for Salesforce partner.

Download Salesforce CLI

Salesforce Command Line Interface (CLI) is a powerful tool which removes complexity and deliver flexible and configurable Scratch Orgs. To create Scratch Org, Salesforce CLI should be installed in your local system.

Depending upon the Operating system, download Salesforce CLI from below table.

Operating SystemSalesforce CLI Installer
mac OS[]
Windows 32-bit[]
Windows 64-bit[]
Debian / Ubuntu 64[]
Debian / Ubuntu x86 []

Now Install Salesforce CLI in your local system. To check that installation is successful, open Terminal app in Mac and enter sfdx as shown below.

Salesforce CLI installation

Salesforce Dev Hub setup login

We must create an alias DevHub and make it a default org. To create use the following command in terminal command window. Then a new salesforce login page will be opened, enter username and password.

Dev Hub login
  • Click allow to Allow access.
Salesforce Dev Hub login

After authenticating the following message will appear on terminal.

Successfully authorized with org ID 00D6F000002SEW1UAO
You may now close the browser
Salesforce Dev Hun Menu