# New Watcher Dialog

> **TL;DR**
> `File | Settings | Tools | File Watchers - New Watcher` for Windows and Linux
>
>
>
> `CLion | Settings | Tools | File Watchers - New Watcher` for macOS
>
>
>
> `Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `⌘ Comma` (Xcode), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Ctrl+Alt+S` (ReSharper), `⌘ Comma` (ReSharper (macOS)), `Ctrl+Alt+S` (QtCreator), `⌘ Comma` (QtCreator (macOS)), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS)) ![the Settings icon](https://resources.jetbrains.com/help/img/idea/2026.2/app.expui.general.settings.svg)

> **Note: Prerequisites**
> [Install](managing-plugins.html#install_plugin_from_repo) and enable the File Watchers plugin.

> **Warning:**
> File Watchers do not start when you open a project in the Safe Mode. For more information, refer to [Project security](project-security.html).

The dialog opens when you click the Add  ![the Add button](https://resources.jetbrains.com/help/img/idea/2026.2/app.expui.general.add.svg) or Edit  ![the Edit button](https://resources.jetbrains.com/help/img/idea/2026.2/app.expui.general.edit.svg) button on the [File Watchers page](settings-tools-file-watchers.html). Use the dialog to create a project File Watcher based on a predefined CLion File Watcher template or to edit an existing project File Watcher.

Each template contains the settings that are optimal for the selected tool. So in most cases, all you need is specify the path to the tool's executable.

## Name

In the Name field, type the name of the File Watcher. By default, CLion suggests the name of the selected predefined template.

## Files to watch

| File type |     Use this list to specify the expected type of input files.  The File Watcher will consider only files of this type as subject for analyzing and processing. File types are recognised based on [associations between file             types and file extensions](creating-and-registering-file-types.html#register-new-association).       > **Tip:** > By default, the field shows the file type in accordance with the chosen predefined template.    |
| Scope |     Use this list to define the range of files the File Watcher can be applied to.        Changes in these files will invoke the File Watcher either immediately or upon save or frame deactivation, depending on the status of the Auto-save edited files to trigger the watcher checkbox.       Select one of the predefined scopes from the list. For a project-level File Watcher, you can also click ![the Browse button](https://resources.jetbrains.com/help/img/idea/2026.2/app.general.ellipsis.svg) to configure a custom scope in the Scopes dialog that opens.           * All Places: all the scopes listed below.    * Project Files: all the files within the project roots.    * Scratches and Consoles: all the files from the Scratches and Consoles directory located in the Project tool window.    * Open Files: all the files that are currently opened in the editor.    * Current File: the file opened in the active editor tab.        Alternatively, click ![the Browse button](https://resources.jetbrains.com/help/img/idea/2026.2/app.general.ellipsis.svg) and configure a custom scope in the Scopes dialog that opens.        > **Tip:** > For more information, refer to [Scopes and file colors](configuring-scopes-and-file-colors.html).                     |
| Track only root files |   A root file is a file that is not included (for example via `import`) in any other file [within the specified scope](#scope).      * When this checkbox is selected, the File Watcher runs only against the root files.    * When the checkbox is cleared, the File Watcher runs against the file from which it is invoked and against all the files in which this file is included recursively within the specified scope.       Note that the Scope setting overrides the Track only root files checkbox setting: if a dependency is outside the specified scope, the File Watcher is not applied to it.        Example Suppose you have two files `root.scss` and `another.scss` where `root.scss` imports  `another.scss`. With the  Track only root files checkbox selected, editing `another.scss` invokes the File Watcher only on `root.scss`. Otherwise, if the checkbox is cleared, the File Watcher processes both of these files.      > **Tip:** > This option is available only for Babel, Closure Compiler, Jade, Less, Sass/SCSS, Stylus, and UglifyJS (terser).    |

## Tool to run on changes

In this area, configure interaction with the tool: specify the executable file to use, the arguments to pass to it, and where CLion should look for the tool's output.

| Program |     In this field, specify the path to the tool's executable file (`.com`, `.exe`, `.cmd`, `.bat`, or other depending on the specific tool.)        > **Tip:** > * To use the program filename instead of the filename path, add the path to its folder to the system environment variable PATH. > > * On Windows, you can skip the `.com`, `.exe`, `.cmd` or `.bat` extension. > > * To use a `jar` archive, specify the absolute path to it. Alternatively, to use a relative path, add its parent folder to the [CLion path variables](absolute-path-variables.html) on the Appearance & Behavior \| Path Variables settings page `Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `⌘ Comma` (Xcode), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Ctrl+Alt+S` (ReSharper), `⌘ Comma` (ReSharper (macOS)), `Ctrl+Alt+S` (QtCreator), `⌘ Comma` (QtCreator (macOS)), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS)) .    |
| Arguments |     In this field, define the arguments to pass to the tool and thus influence its behaviour.        Arguments are usually specified using [macros](built-in-macros.html), for example, `$FileName$` or `$FileNameWithoutExtension$`, that will be replaced with the actual filenames.       Type the macros manually or click ![the Insert Macros icon](https://resources.jetbrains.com/help/img/idea/2026.2/app.general.inlineAddHover.svg) and select the relevant pattern fom the list in the Macros dialog that opens.        > **Tip:** > When specifying the arguments, follow these rules: > > * Use spaces as separators. > > * If an argument contains spaces, enclose them or the entire argument in double quotes: `some" "arg` or `"some arg"`. > > * If an argument contains double quotes, use backslashes to escape them: `-Dmy.prop=\"quoted_value"\`.                     |
| Output paths to refresh |     In this field, tell CLion where it should search for the tool's output: the resulting source code, source maps, dependencies, or the file itself. The location of the output is tool-specific.                                 Output paths are usually specified using [macros](built-in-macros.html). You can type them manually or click ![the Insert Macros icon](https://resources.jetbrains.com/help/img/idea/2026.2/app.general.inlineAddHover.svg) and select the relevant one from the list in the dialog that opens.       To specify several macros, use colons `:` as separators, for example, `$FileNameWithoutExtension$.css:$FileNameWithoutExtension$.css.map`.                                > **Note:** > Changing the value in the Output paths to refresh field does not make the tool store its output in another place. If you still need to do that, specify the desired custom output location in the Arguments field: type the output paths with colons as separators and use macros.        |

## Working Directory and Environment Variables

| Working directory |     In this field, specify the directory to which the tool will be applied.  Because the tool is always invoked in the context of a file, the default working directory is the directory of the current file. The default working directory is specified in all predefined templates with the `$FileDir$` macro. To specify a custom working directory, type the path to it in the field, or click  ![the Browse icon](https://resources.jetbrains.com/help/img/idea/2026.2/app.general.openDiskHover.svg) and select the directory in the Select Path  dialog, or click ![the Insert Macros icon](https://resources.jetbrains.com/help/img/idea/2026.2/app.general.inlineAddHover.svg) and select the desired [macro](built-in-macros.html) from the list in the Macros dialog.                            > **Tip:** > If you leave the Working Directory field empty, CLion uses the directory of the file where the File Watcher is invoked.    |
| Environment variables |  In this field, specify the environment variables that the tool requires but that are not specified at the operating system level.  |

## Advanced Options

|  Auto-save edited files to trigger the watcher  |      * When this checkbox is selected, CLion immediately saves a file as soon as you edit it so the File Watcher wakes up immediately.    * When the checkbox is cleared, the File Watcher starts upon save (`File \| Save All`) or when you move the focus from CLion (on frame deactivation).    |
|  Trigger the watcher on external changes  |      * When this checkbox is selected, the File Watcher wakes up on any changes to a file from its scope, including changes made outside CLion or the changes after you check out a branch in your version control system.    * When the checkbox is cleared, the File Watcher starts only when a file from its scope is updated from CLion and ignores other changes, for example, changes received from your version control system.    |
|  Trigger watcher regardless of syntax errors  |      * When the checkbox is selected, the File Watcher start regardless of the syntactical correctness of a file. The File Watcher will start upon update, save, or frame deactivation, depending on the status of the Auto-save edited files to trigger the watcher checkbox.    * When this checkbox is cleared, the File Watcher ignores all triggers in files that are syntactically invalid and starts only in error-free files.    |
| Create output file from stdout |   * In most cases, this checkbox should be cleared because most tools write their output to the relevant files directly.    * When this checkbox is selected, CLion reads the native tool's output `standard output stream (stdout)` and generates the resulting file from it. The name of the generated file is taken from the Output paths to refresh field. If the field contains several names, the first one in the list is used.    |
|  Show console  |     From this list, select when you want the File Watcher to open the console.         * Always: with this option, the console always opens after the tool execution is completed.    * On error: with this option, the console opens after the tool execution only when the `Exit code` is different from `0`.    * Never: choose this option to suppress opening the console at all.     |
| Output Filters |     In this field, specify the output filters associated with the tool.  Based on these filters, absolute file paths and line numbers in the tool's output are converted into hyperlinks. Clicking those links opens the corresponding files in the editor.   For example, to get useful error messages displayed, type `$FILE_PATH$:$LINE$ $MESSAGE$`         |

## See also

### Procedures

[File Watchers](using-file-watchers.html)

### Reference

[File Watchers](settings-tools-file-watchers.html)

