Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Installation

CLI

The CLI supports automatically installing the latest released version of the linter if you do not have it installed already. Make sure you have the CLI first, then simply run the lint subcommand:

bevy lint

The CLI will prompt you if you wish to install the linter. Note that it will assume you are using Rustup, and if that isn't the case you should install the linter manually instead. Type y and press enter to accept:

warning: failed to run bevy_lint, trying to find automatic fix...
`bevy_lint` is missing, should I install it for you? [y/n]

If you want to auto-confirm the prompt, you may pass --yes to the command. Note that if you are installing the linter in CI, you may wish to use the dedicated Github Action instead:

bevy lint --yes

Manual with Rustup

bevy_lint requires a specific nightly Rust toolchain with the rustc-dev and llvm-tools-preview components. You can install the toolchain required for the latest release with:

rustup toolchain install nightly-2025-05-14 \
    --component rustc-dev \
    --component llvm-tools-preview

If you are installing a different version of the linter, you may need to install a different nightly toolchain as specified by the compatibility table. Please be aware that you must keep this toolchain installed for bevy_lint to function1.

Once you have the toolchain installed, you can compile and install bevy_lint through Cargo:

rustup run nightly-2025-05-14 cargo install \
    --git https://github.com/TheBevyFlock/bevy_cli.git \
    --tag lint-v0.3.0 \
    --locked \
    bevy_lint

If you're installing a different version of the linter, you may need to switch the toolchain and tag in the above command.

Manual without Rustup

It is possible to use the linter without Rustup, however it requires some extra steps. First, you'll need to install the required nightly Rust toolchain (check the compatibility table) through some other means. If you're using Nix, for example, you would use a Rust overlay to do this. Make sure to also install the rustc-dev and llvm-tools-preview components for the toolchain.

Once you've installed the toolchain and components, use that toolchain's cargo to build the linter:

my-toolchain/bin/cargo install \
    --git https://github.com/TheBevyFlock/bevy_cli.git \
    --tag lint-v0.3.0 \
    --locked \
    bevy_lint

Next, you'll need to note down the absolute path the toolchain was installed at. You can easily find it by running:

my-toolchain/bin/rustc --print sysroot

Finally, you will need to set the BEVY_LINT_SYSROOT environmental variable any time you run bevy_lint. The easiest way to do this on Unix-based systems is to set it in a startup script like .bashrc or .profile:

export BEVY_LINT_SYSROOT=/absolute/path/to/sysroot

Uninstall

If you wish to uninstall the linter at any time, you may use Cargo to do so:

cargo uninstall bevy_lint

You may also wish to uninstall the Rustup toolchain. The following command will uninstall the toolchain required by the latest version of the linter, but you may need to specify a different toolchain from the compatibility table:

rustup toolchain uninstall 2025-05-14

Upgrade

To upgrade to a newer version of the linter, first uninstall it then follow the CLI or manual installation instructions.


  1. bevy_lint imports internal rustc libraries in order to hook into the compiler process. These crates are stored in a dynamic library that is loaded by bevy_lint at runtime. Uninstalling the nightly toolchain would remove this dynamic library, causing bevy_lint to fail.