# How draw.io Desktop Handles the `--disable-update` and `--silent-update` Command-Line Arguments

> Discover how draw.io Desktop uses --disable-update and --silent-update command-line arguments to control application updates. Learn about startup flag handling for seamless management.

- Repository: [draw.io/drawio-desktop](https://github.com/jgraph/drawio-desktop)
- Tags: internals
- Published: 2026-03-05

---

**draw.io Desktop reads the `--disable-update` and `--silent-update` flags at application startup in [`src/main/electron.js`](https://github.com/jgraph/drawio-desktop/blob/main/src/main/electron.js) to either disable automatic updates entirely or enable silent background installations without displaying user prompts.**

When launching the **jgraph/drawio-desktop** application, users can control the automatic update mechanism via specific draw.io Desktop command-line arguments. These flags determine whether the app checks for new versions, displays update dialogs, or installs updates automatically when quitting.

## Parsing Logic in the Main Process

The application evaluates command-line arguments and environment variables early in the main process lifecycle. In [`src/main/electron.js`](https://github.com/jgraph/drawio-desktop/blob/main/src/main/electron.js) (lines 32‑38), the code constructs two Boolean flags that govern all subsequent update behavior:

```javascript
const disableUpdate = disUpPkg() ||
    process.env.DRAWIO_DISABLE_UPDATE === 'true' ||
    process.argv.indexOf('--disable-update') !== -1 ||
    fs.existsSync('/.flatpak-info');

const silentUpdate = !disableUpdate && (
    process.env.DRAWIO_SILENT_UPDATE === 'true' ||
    process.argv.indexOf('--silent-update') !== -1);

```

The `disableUpdate` variable becomes `true` if any of the following conditions are met:
- The helper function `disUpPkg()` (defined in [`src/main/disableUpdate.js`](https://github.com/jgraph/drawio-desktop/blob/main/src/main/disableUpdate.js)) returns true
- The environment variable `DRAWIO_DISABLE_UPDATE` is set to `'true'`
- The `--disable-update` argument is present in `process.argv`
- The file `/.flatpak-info` exists (indicating a Flatpak sandboxed environment)

The `silentUpdate` flag only evaluates to `true` when updates are **not** disabled and either the `--silent-update` argument or `DRAWIO_SILENT_UPDATE` environment variable is set.

## Impact on the Native Menu Bar

When `disableUpdate` is true, the application removes the *Check for updates* menu entry from the macOS native menu template. This occurs in [`src/main/electron.js`](https://github.com/jgraph/drawio-desktop/blob/main/src/main/electron.js) (lines 75‑78):

```javascript
if (disableUpdate) {
    template[0].submenu.splice(2, 1);
}

```

This ensures users cannot manually trigger update checks from the UI when the feature is disabled via command-line arguments.

## Configuring the Auto-Updater Instance

The **electron-updater** instance is configured immediately after flag detection based on the `silentUpdate` value. In [`src/main/electron.js`](https://github.com/jgraph/drawio-desktop/blob/main/src/main/electron.js) (lines 40‑44), the code sets:

```javascript
autoUpdater.autoDownload = silentUpdate;
autoUpdater.autoInstallOnAppQuit = silentUpdate;

```

When `silentUpdate` is `true`, the application automatically downloads updates in the background and installs them when the user quits the app. When `false`, the updater waits for explicit user confirmation before downloading.

## Suppressing Update Dialogs

The application intercepts the `update-available` event to conditionally suppress UI dialogs. As implemented in [`src/main/electron.js`](https://github.com/jgraph/drawio-desktop/blob/main/src/main/electron.js) (lines 180‑186), the event handler returns early when silent updates are enabled:

```javascript
autoUpdater.on('update-available', (a, b) => {
    if (silentUpdate) return;
    // ... display update dialog to user ...
});

```

This prevents any interactive prompt from appearing when `--silent-update` is active, allowing the process to proceed unattended.

## Initial Update Check Behavior

At the end of the startup routine (lines 194‑199), the application decides whether to poll for updates based on the `disableUpdate` flag and user preferences stored in the electron-store:

```javascript
if (store == null || (!disableUpdate && !store.get('dontCheckUpdates'))) {
    autoUpdater.checkForUpdates();
}

```

If `--disable-update` is specified, the `checkForUpdates()` method is never called, eliminating all network traffic related to version checking.

## Practical Usage Examples

Run the application without any update functionality:

```bash
drawio --disable-update

```

Enable background updates without user interaction:

```bash
drawio --silent-update

```

Use environment variables as alternatives to flags:

```bash
DRAWIO_DISABLE_UPDATE=true drawio
DRAWIO_SILENT_UPDATE=true drawio

```

## Summary

- **`--disable-update`** completely disables automatic updates, removes menu entries, and prevents network checks for new versions.
- **`--silent-update`** enables automatic downloading and installation of updates on quit while suppressing all interactive dialogs.
- Both flags are evaluated in [`src/main/electron.js`](https://github.com/jgraph/drawio-desktop/blob/main/src/main/electron.js) alongside equivalent environment variables (`DRAWIO_DISABLE_UPDATE` and `DRAWIO_SILENT_UPDATE`).
- The `disUpPkg()` helper in [`src/main/disableUpdate.js`](https://github.com/jgraph/drawio-desktop/blob/main/src/main/disableUpdate.js) provides an additional programmatic method to disable updates.
- Flatpak installations automatically disable updates via the `/.flatpak-info` file detection.

## Frequently Asked Questions

### What is the difference between `--disable-update` and `--silent-update` in draw.io Desktop?

`--disable-update` turns off all automatic update functionality, including menu items and network requests to check for new versions. `--silent-update` keeps the update mechanism active but removes user prompts, allowing the application to download and install updates automatically in the background when the app quits.

### Can I disable updates in draw.io Desktop without using command-line arguments?

Yes. You can set the environment variable `DRAWIO_DISABLE_UPDATE=true` before launching the application, which produces the same effect as the `--disable-update` flag. Additionally, if the application detects it is running inside a Flatpak container (by checking for `/.flatpak-info`), it automatically disables updates.

### Does `--silent-update` work if I also specify `--disable-update`?

No. The `silentUpdate` flag is explicitly dependent on `disableUpdate` being false. As shown in the source code ([`src/main/electron.js`](https://github.com/jgraph/drawio-desktop/blob/main/src/main/electron.js), line 36), the silent update logic is wrapped in `!disableUpdate && (...)`, meaning silent updates are only considered when updates are not disabled.

### Where is the update logic implemented in the draw.io Desktop source code?

The primary implementation resides in [`src/main/electron.js`](https://github.com/jgraph/drawio-desktop/blob/main/src/main/electron.js), specifically between lines 32‑38 (flag detection), lines 40‑44 (auto-updater configuration), lines 75‑78 (menu modification), and lines 180‑199 (event handling and initial checks). The helper function `disUpPkg()` is defined in [`src/main/disableUpdate.js`](https://github.com/jgraph/drawio-desktop/blob/main/src/main/disableUpdate.js).