Newer Version Available
Environment Variables
You can set environment variables to configure some values that Salesforce CLI and
Salesforce DX tooling use.
Salesforce CLI Environment Variables
Environment variables override CLI runtime configuration values. (Linux and Mac
only) To set an environment variable for only the command you’re
running:
1SFDX_API_VERSION=44.0 sfdx force:org:create -<options>| Environment Variable | Description |
|---|---|
| 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_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 production org. However, let’s say you decide to use the pre-release version of the CLI (v43 in Summer ‘18), but your production org is running the current API version (v42 in Spring ‘18). In this case, you’d want to set this value to match the API version of your production org (v42). |
| 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 is displayed in green. If the percent is lower, it is displayed in red. Applies only to human-readable output. Default is 70%. |
| SFDX_CONTENT_TYPE | All CLI commands output results in JSON format. |
| 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_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_JSON_TO_STDOUT | Sends messages when Salesforce CLI commands fail to stdout instead of stderr.
Setting this environment variable to true is
particularly helpful for scripting use cases. We plan to send Salesforce CLI error
output to stdout by default in CLI
v45. Example: |
| SFDX_LOG_LEVEL | Sets the level of messages that the CLI writes to the log file. |
| 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. |
| 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.Example: 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. |
| 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_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. |
General Environment Variables
| Environment Variable | Description |
|---|---|
| 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: |
| 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: |
| 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 | Indicate 0 to allow Node.js to use the self-signed certificate in the certificate chain. |