Newer Version Available

This content describes an older version of this product. View Latest

Environment Variables

You can set environment variables to configure certain values that Salesforce CLI and Salesforce DX tooling use.

Salesforce CLI Environment Variables

Environment variables override CLI runtime configuration values. To set an environment variable for only the command you’re running, append the variable, like this:

1SFDX_API_VERSION=50.0 sfdx force:org:create -<options>
FORCE_OPEN_URL
Specifies the web page that opens in your browser when you run force:org:open. For example, to open Lightning Experience, set to lightning.

Equivalent to the --path parameter of force:org:open.

FORCE_SHOW_SPINNER
Set to true to show a spinner animation on the command line when running asynchronous CLI commands. Default is false.
FORCE_SPINNER_DELAY
Specifies the speed of the spinner in milliseconds. Default is 60.
SFDX_ACCESS_TOKEN
Specifies an access token when using the auth:accesstoken:store command. If you don’t set this environment variable, the command prompts you for the access token. Useful for CI/CD scripts.
SFDX_API_VERSION
The API version for a specific project or all projects. Normally, the Salesforce CLI assumes that you’re using the same version of the CLI as your Dev Hub.
SFDX_AUDIENCE_URL
Overrides the aud (audience) field used for JWT authentication so that it matches the expected value of the authorization server URL for the org you’re logging into. For example, https://MyDomainName.my.salesforce.com or https://login.salesforce.com for a production org, and https://MyDomainName--SandboxName.sandbox.my.salesforce.comor https://test.salesforce.com for a sandbox.
SFDX_CODE_COVERAGE_REQUIREMENT
Specifies the code coverage percentages that are displayed in green when you run force:apex:test:run or force:apex:test:report with the --codecoverage parameter.

If the code coverage percentage for an Apex test is equal to or higher than this setting, it’s displayed in green. If the percent is lower, it’s displayed in red. Applies only to human-readable output. Default is 70%.

SFDX_CONTENT_TYPE
When set to JSON, specifies that all CLI commands output results in JSON format. If you set the environment variable to any other value, or unset it, the CLI commands output their results as specified by the parameters.
SFDX_CUSTOM_ORG_METADATA_TEMPLATES
Specifies either a local directory or a cloned GitHub repository that contains the default custom code templates used by the force:project:create command. The GitHub URL points to either the root directory that contains your templates or to a subdirectory on a branch in the repo that contains your templates.

Example:

1SFDX_CUSTOM_ORG_METADATA_TEMPLATES=https://github.com/mygithubacct/salesforcedx-templates
SFDX_DEFAULTDEVHUBUSERNAME
Specifies the username of your default Dev Hub org so you don’t have to use the --targetdevhubusername CLI parameter. Overrides the value of the defaultdevhubusername runtime configuration value.
SFDX_DEFAULTUSERNAME
Specifies the username of your default org so you don’t have to use the --targetusername CLI parameter. Overrides the value of the defaultusername runtime configuration value.
SFDX_DISABLE_AUTOUPDATE or SFDX_AUTOUPDATE_DISABLE (either var works)
Set to true to disable the auto-update feature of the CLI. By default, the CLI periodically checks for and installs updates.
SFDX_DISABLE_SOURCE_MEMBER_POLLING
Set to true to disable polling of your org’s SourceMember object when you run the force:source:push|pull commands.

The commands poll the SourceMember object to track what's changed between your local source and the org after the push or pull completes. If you have a large metadata deployment, however, the polling can take a while, or even time out. Sometimes you don't require source tracking at all, such as in a CI/CD job. These use cases are good candidates for setting this environment variable.

The environment variable works with both scratch orgs and sandboxes.

When you disable SourceMember polling, the CLI’s internal tracking of what’s changed between your local source and org metadata gets out of sync. As a result, subsequent runs of the force:source:push|pull|status commands are unreliable, and it’s up to you to synchronize your source. To reset source tracking, use the force:source:tracking:reset command.

Warning

SFDX_DISABLE_TELEMETRY
Set to true to disable the CLI from collecting usage information, user environment information, and crash reports.
SFDX_DNS_TIMEOUT
Specifies the number of seconds that the force:org:* commands wait for a response when checking whether an org is connected. If the commands don’t receive a response in that time, they time out. Default value is 3.
SFDX_DOMAIN_RETRY
Specifies the time, in seconds, that the CLI waits for the Lightning Experience custom domain to resolve and become available in a newly created scratch org.

The default value is 240 (4 minutes). Set the variable to 0 to bypass the Lightning Experience custom domain check entirely.

SFDX_HIDE_RELEASE_NOTES
Set to true to silence the automatic display of the release notes when you run sfdx update. Default value is false.

Example:

1SFDX_HIDE_RELEASE_NOTES=true
SFDX_HIDE_RELEASE_NOTES_FOOTER
Set to true to silence the boilerplate footer about displaying the release notes when you run sfdx update. Default value is false.

Example:

1SFDX_HIDE_RELEASE_NOTES_FOOTER=true
SFDX_IMPROVED_CODE_COVERAGE
Scopes Apex test results to the classes entered during a test run when running force:apex:test:run and force:apex:test:report. Set to true to improve code coverage.
SFDX_INSTANCE_URL
The URL of the Salesforce instance that is hosting your org. Default value is https://login.salesforce.com. We recommend that you set this value to the My Domain login URL for your org. You can find the My Domain login URL on the My Domain page in Setup.
SFDX_JSON_TO_STDOUT
Sends messages when Salesforce CLI commands fail to stdout instead of stderr. Setting this environment variable to true is helpful for scripting use cases.

Example:

1SFDX_JSON_TO_STDOUT=true
SFDX_LOG_LEVEL
Sets the level of messages that the CLI writes to the log file.

Example:

1SFDX_LOG_LEVEL=debug
SFDX_LOG_ROTATION_PERIOD
Time period after which Salesforce CLI rotates the log file. Rotating the log file means making a backup copy of the file and then clearing out the current log file to start afresh. For example, if set to 1d, Salesforce CLI rotates the log file daily at midnight. If set to 2w, the file is rotated every 2 weeks. See the period entry in this table for other time period options. Default value is 1d.

Example:

1SFDX_LOG_ROTATION_PERIOD=2w
SFDX_LOG_ROTATION_COUNT
Number of backup files to keep when rotating the log file. Default value is 2. See SFDX_LOG_ROTATION_PERIOD for more information

Example:

1SFDX_LOG_ROTATION_COUNT=10
SFDX_MAX_QUERY_LIMIT
The maximum number of Salesforce records returned by a CLI command. Default value is 10,000.

Example:

1SFDX_MAX_QUERY_LIMIT=200000
SFDX_MDAPI_TEMP_DIR
Places the files (in metadata format) in the specified directory when you run some CLI commands, such as force:source:<name>. Retaining these files can be useful for several reasons. You can debug problems that occur during command execution. You can use the generated package.xml when running subsequent commands, or as a starting point for creating a manifest that includes all the metadata you care about.
1SFDX_MDAPI_TEMP_DIR=/users/myName/myDXProject/metadata
SFDX_NPM_REGISTRY
Sets the URL to a private npm server, where all packages that you publish are private. We support only repositories that don’t require authentication.
1SFDX_NPM_REGISTRY=<full_URL>

Example:

1SFDX_NPM_REGISTRY=http://mypkgs.myclient.com/npm/my_npm_pkg

Verdaccio is an example of a lightweight private npm proxy registry.

SFDX_PRECOMPILE_ENABLE
Set to true to enable Apex pre-compile before the tests are run. This variable works with the force:apex:test:run command. Default is false.

The duration of an Apex test pre-compilation can be inconsistent. As a result, runs of the same Apex tests are sometimes quick and other times they time out. We recommend that you set this variable to true only if your Apex tests (without pre-compile) activate multiple concurrent Apex compilations that consume many system resources.

Important

SFDX_PROJECT_AUTOUPDATE_DISABLE_FOR_PACKAGE_CREATE
For force:package:create, disables automatic updates to the sfdx-project.json file.
SFDX_PROJECT_AUTOUPDATE_DISABLE_FOR_PACKAGE_VERSION_CREATE
For force:package:version:create, disables automatic updates to the sfdx-project.json file.
SFDX_REST_DEPLOY
Set to true to make Salesforce CLI use the Metadata REST API for deployments. By default, the CLI uses SOAP. Deployments using REST aren’t bound by the 39-MB .zip file size limit that applies to SOAP deployments.
SFDX_SOURCE_MEMBER_POLLING_TIMEOUT
Set to the number of seconds you want the force:source:push command to keep polling the SourceMember object before the command times out. The force:source:push command polls the SourceMember object to track what's changed between your local source and the org after the push completes. The CLI calculates a time-out for each force:source:push command run based on the number of components it deploys. Use this environment variable to override the calculated time-out.

For example, if the push times out after 3 minutes, try setting a time-out of 5 minutes (300 seconds):

1SFDX_SOURCE_MEMBER_POLLING_TIMEOUT=300
SFDX_USE_GENERIC_UNIX_KEYCHAIN
(Linux and macOS only) Set to true if you want to use the generic UNIX keychain instead of the Linux libsecret library or macOS keychain. Specify this variable when using the CLI with ssh or "headless" in a CI environment.
SFDX_USE_PROGRESS_BAR
For force:mdapi:deploy, force:source:deploy, and force:source:push, set to false to disable the progress bar.

Examples:

To set globally: SFDX_USE_PROGRESS_BAR=false.

To set for a single command: SFDX_USE_PROGRESS_BAR=false sfdx force:source:deploy.

General Environment Variables

HTTP_PROXY
If you receive an error when you install or update the Salesforce CLI on a computer that’s behind a firewall or web proxy, set this environment variable. Use the URL and port of your company proxy, for example:
1http://username:pwd@proxy.company.com:8080
HTTPS_PROXY
If you receive an error when you install or update the Salesforce CLI on a computer that’s behind a firewall or web proxy, set this environment variable. Use the URL and port of your company proxy, for example:
1http://username:pwd@proxy.company.com:8080
NODE_EXTRA_CA_CERTS
Installs your self-signed certificate. Indicate the fully qualified path to the certificate file name. Then run sfdx update.

See NODE_EXTRA_CA_CERTS=file for more details.

NODE_TLS_REJECT_UNAUTHORIZED
To allow Node.js to use the self-signed certificate in the certificate chain, indicate 0.