Setting Environment Variables in Salesforce DX?

I am looking to update SFDX_IMPROVED_CODE_COVERAGE Environment variable to true. Loosely documented here and here. I am using the syntax documented here that seems to show that I can update that Environment variable with something like this:

sfdx force:config:set improvedCodeCoverage=true

however i get this error in the terminal: ERROR running force:config:get: Unknown config key: improvedCodeCoverage.

Any ideas on what i am doing wrong here? coverting to camelcase seems to be what is documented


Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

SFDX config values and environment variable-based configuration are not necessarily congruent, and at least based on the documentation, it looks like these are not: you have to actually set the environment variable.

You can do that for a single command by doing

SFDX_IMPROVED_CODE_COVERAGE=true sfdx force:do:work ...

or set it for a shell session with


If you wish that to be permanent, set it in the config file for your shell (such as ~/.zshrc if you use zsh).

Method 2

Environment variables always refer to the system’s environment variables, not any configuration settings in an app. You can see your current variables with env in any Windows shell. To set them globally, go to Win+X, System, System Info > Advanced System Settings > Environment Variables…, and add a new variable there. Make sure you restart any terminals/shells for the variables to take effect. As mentioned by David, msys32/bash/zsh/etc have “rc” files that you can use to set an environment variable for a single terminal as well. Refer to the online help manual for whichever shell you’re using.

All methods was sourced from or, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Notify of

Inline Feedbacks
View all comments
Would love your thoughts, please comment.x