Skip to main content

Devbox Env Variables

The following is a list of Environment variables used by Devbox to manage your environment. Some of these variables are set by Devbox, while others can be used to manage how Devbox sets up your shell.

Note that this list only describes variables that are set by Devbox itself. Devbox plugins may set their own environment variables, which are documented in their respective pages and via devbox info <package>.

Environment Variables Set by Devbox Shell

Below are some useful environment variables that Devbox sets up for you. These variables can be used in your scripts to access information or write scripts for your current project environment.

VariableDescription
DEVBOX_CONFIG_DIRThe directory where Devbox stores user-editable config files for your project's packages. These files can be checked into source control
DEVBOX_PACKAGES_DIRThe directory containing the binaries and files for the packages in your current project
DEVBOX_PROJECT_ROOTThe root directory of your current project. This will match the directory location of the devbox.json file for your currently running shell
DEVBOX_PURE_SHELLIndicates whether you are running your current shell in pure mode. Pure mode clears your current environment variables before starting a devbox shell
DEVBOX_SHELL_ENABLEDWhether or not Devbox is enabled in the current shell. This is automatically set to 1 when you start a shell, run a script, or start services
DEVBOX_WDYour current working directory. This can be used when writing scripts that you want to run in your current directory, instead of DEVBOX_PROJECT_ROOT

Environment Variables for Managing Devbox

Below are some environment variables that can be used to manage how Devbox sets up your shell. These variables can be set in your shell or in your devbox.json file.

VariableDescriptionValue
DEVBOX_DEBUGEnable debug output for Devbox. If set to 1, this will print out additional information about what Devbox is doing.0
DEVBOX_FEATURE_DETSYS_INSTALLERIf enabled, Devbox will use the Determinate Systems installer to setup Nix on your system. This variable must be set on your host0
DEVBOX_NO_PROMPTDisables the default shell prompt modification for Devbox. Usually used if you want to configure your own prompt for indicating that you are in a devbox sell0
DEVBOX_PC_PORT_NUMSets the port number for process-compose when running Devbox services. If this variable is unset and a port is not provided via the CLI, Devbox will choose a random available portunset
DEVBOX_USE_VERSIONSetting this variable will force Devbox to use a different version than the current latest. For example: DEVBOX_USE_VERSION=0.13.0 will install and use Devbox v0.13 for all Devbox commands. This variable must be set on your hostunset