Draw.io Desktop Environment Variables: Controlling Dev Mode and Updates with DRAWIO_ENV and DRAWIO_DISABLE_UPDATE

Draw.io Desktop checks DRAWIO_ENV and DRAWIO_DISABLE_UPDATE at launch to enable Chromium DevTools and verbose logging or to suppress automatic update checks.

The jgraph/drawio-desktop repository exposes these environment variables in its main Electron process, allowing power users and developers to alter runtime behavior without modifying source code. When DRAWIO_ENV is set to dev, the application opens developer tools and loads from source, while DRAWIO_DISABLE_UPDATE prevents the auto-updater from querying GitHub releases.

How DRAWIO_ENV Controls Developer Mode

In src/main/electron.js, the application reads process.env.DRAWIO_ENV during initialization. If the value equals "dev", the code sets an internal isDev flag to true, automatically opens the browser DevTools via win.webContents.openDevTools(), and adjusts logging levels for debugging purposes.

Source Implementation Details

The environment check occurs early in the main process lifecycle before the renderer window loads. When the variable is detected, the flag triggers development-specific code paths that load the application from the local source tree rather than the packaged production bundle, enabling live-reload scenarios and source map support.

Enabling Development Mode

Set the variable before launching the application:

export DRAWIO_ENV=dev
npm start

This configuration is essential when debugging the main process, inspecting the renderer's DOM structure, or tracing IPC messages between processes.

Disabling Automatic Updates with DRAWIO_DISABLE_UPDATE

The src/main/disableUpdate.js module inspects process.env.DRAWIO_DISABLE_UPDATE at startup. When this variable is present and truthy, the code disables the Electron autoUpdater module and prevents any network requests that check for new releases on GitHub.

Update Suppression Logic

The module short-circuits the update routine before it initializes, ensuring the "Check for Updates" menu item becomes disabled and no background update polling occurs. This is particularly useful in sandboxed environments, CI pipelines, or when managing versions through external package managers like Homebrew or Chocolatey.

Running Without Update Checks

Prevent the auto-updater from activating:

export DRAWIO_DISABLE_UPDATE=1
npm start

With this setting, the application runs entirely offline regarding updates, eliminating network traffic to the release endpoint and preventing unexpected update prompts during presentations or critical work sessions.

Complete Configuration Examples

Combine both variables for a fully sandboxed development session:

export DRAWIO_ENV=dev
export DRAWIO_DISABLE_UPDATE=1
npm start

For a single command without persisting the variables in your shell session:

DRAWIO_ENV=dev DRAWIO_DISABLE_UPDATE=1 npm start

You can also export these variables system-wide or inject them via a .env file loader, provided the variables are present in the environment when the Electron main process spawns.

Summary

  • DRAWIO_ENV: Set to dev in src/main/electron.js to enable Chromium DevTools, verbose logging, and development asset loading.
  • DRAWIO_DISABLE_UPDATE: Set to any truthy value in src/main/disableUpdate.js to disable the auto-updater and prevent GitHub release checks.
  • Both variables are optional; omitting them runs the application in standard production mode with automatic updates enabled and developer tools hidden.

Frequently Asked Questions

What values does DRAWIO_ENV accept?

According to the source in src/main/electron.js, the codebase specifically checks for the string "dev". Any other value, or an unset variable, causes the application to run in production mode without opening developer tools or enabling verbose logging.

Does DRAWIO_DISABLE_UPDATE work on all platforms?

Yes. Since the check occurs in the main JavaScript process before platform-specific native updater code executes, setting this variable disables updates on macOS, Windows, and Linux builds equally, preventing the auto-updater from initializing regardless of the underlying operating system.

Can these variables be set via a configuration file?

No. As implemented in jgraph/drawio-desktop, these settings are strictly read from process.env at startup in the main process. They cannot be configured through the application's UI, command-line flags, or user settings JSON files; they must be exported in the shell environment before the Electron binary launches.

Will DRAWIO_ENV affect the packaged application binary?

Yes. Even when running a packaged Electron binary from a release download, you can prepend the variable to the launch command (e.g., DRAWIO_ENV=dev ./drawio on Linux/macOS or set DRAWIO_ENV=dev && drawio.exe on Windows) to force development mode, provided the source maps and development dependencies are available in the file tree.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →