Sub topic 4
Enabling Dev Hub in Setup
This chapter walks through turning on Dev Hub in a Salesforce org. It assumes you can log in as a system administrator of a production, Developer Edition, or trial org, and that you know your way around Setup. You don't need the CLI yet. You will authorize the org from the CLI in the next chapter.
What you are switching on
Dev Hub is a feature flag on an org. Once it is on, the org can create scratch orgs and track them. Enabling it doesn't change your data, metadata, or existing users.
Check eligibility first
Dev Hub can be enabled in production orgs, Developer Edition orgs, and trial orgs. It can't be enabled in sandboxes or in scratch orgs. If you pick the wrong org, the Dev Hub setting won't appear or won't be editable, and you will lose time looking for it.
A Developer Edition org is a good choice for learning. It is free and separate from production, and it isn't tied to a company's release process.
Steps in Setup
- Log in to the org as a system administrator.
- Click the gear icon and choose Setup.
- In Quick Find, type
Dev Hub, then select Dev Hub under Development. - Switch the Enable Dev Hub toggle to on.
- Read the confirmation message, then confirm.
After you enable it, the page also shows options for packaging, such as unlocked packages and second-generation managed packages. You don't need them to create scratch orgs. Leave them alone unless your team plans to build packages.
Who can use the Dev Hub
The administrator who enables it can use it right away. Other users need the right permissions to create and delete scratch orgs. Assign them through a profile or permission set. Without those permissions, a developer can authorize the org but scratch org creation fails with a permissions error. The same applies to developers who log in to the Dev Hub by hand.
Common problems
| Symptom | Likely cause | What to do |
|---|---|---|
| No **Dev Hub** entry in Quick Find | You are in a sandbox or scratch org, or you lack admin rights | Log in to a supported org as a system administrator |
| Toggle is on but a colleague can't create scratch orgs | Missing scratch org permissions | Grant the permissions with a permission set |
| You enabled it in the wrong org | The setting is permanent | Use that org as the Dev Hub, or use a different org from now on |
Exercise
A teammate says they will enable Dev Hub in their sandbox to test it first, then turn it off. Give two reasons this plan won't work.
Show answer
Dev Hub can't be enabled in a sandbox, because only production, Developer Edition, and trial orgs support it. Also, Dev Hub can't be turned off once it is enabled, so there is no "test then disable" workflow. A Developer Edition org is a safer place to try it.
Exercise
Where in Setup do you find the Dev Hub toggle?
Show answer
Open Setup, type "Dev Hub" in Quick Find, and select Dev Hub under Development. Then turn on Enable Dev Hub.