Skip to content
Latchkey

bazelisk Command Reference

Run the exact Bazel version a repo pins, on every machine.

bazelisk is a launcher that picks the right Bazel version per repository and downloads it on demand. It is the recommended way to invoke Bazel, especially in CI.

What it does

bazelisk reads the .bazelversion file (or USE_BAZEL_VERSION) to decide which Bazel release to run, downloads it if needed, and forwards all arguments to it. This guarantees every developer and runner uses the same Bazel version.

Common flags and usage

  • bazelisk build|test|run ...: forwards args to the pinned Bazel
  • .bazelversion file: pins the version per repository
  • USE_BAZEL_VERSION=X: override the version for one invocation
  • Install as the bazel binary so bazel transparently uses it

Example

shell
- name: Build with pinned Bazel
  run: |
    echo "7.4.1" > .bazelversion   # usually already committed
    bazelisk build --config=ci //...

In CI

Invoke bazelisk (or alias bazel to it) so the runner uses exactly the version in .bazelversion, eliminating works-on-my-machine version skew between local and CI builds.

Key takeaways

  • bazelisk runs the Bazel version pinned in .bazelversion.
  • It downloads the right release on demand and forwards all arguments.
  • Using it in CI removes Bazel version skew between machines.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →