Warning

Want even better documentation for Sublime Text?

We are starting a new round of writing and editing to improve this guide in many ways. If you find it useful, please support us.

Build Systems (Batch Processing)

Build systems let you run your files through external programs like make, tidy, interpreters, etc.

Executables called from build systems must be in your PATH. For more information about making sure the PATH seen by Sublime Text is set correctly, see Troubleshooting Build Systems.

File Format

Build systems are JSON files and have the extension .sublime-build.

Example

Here’s an example of a build system:

{
    "cmd": ["python", "-u", "$file"],
    "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
    "selector": "source.python"
}
cmd

Required. This option contains the actual command line to be executed:

python -u /path/to/current/file.ext
file_regex
A Perl-style regular expression to capture error information from an external program’s output. This information is used to help you navigate through error instances with F4.
selector
If the Tools | Build System | Automatic option is set, Sublime Text will automatically find the corresponding build system for the active file by matching selector to the file’s scope.

In addition to options, you can use some variables in build systems too, as we have done above with $file, which expands to the active buffer’s filename.

Where to Store Build Systems

Build systems must be located somewhere under the Packages folder (e.g. Packages/User). Many packages include their own build systems.

Running Build Systems

Build systems can be run by pressing F7 or from Tools | Build.

See also

Reference for build systems
Complete documentation on all available options, variables, etc.

Warning

Want even better documentation for Sublime Text?

We are starting a new round of writing and editing to improve this guide in many ways. If you find it useful, please support us.