bazel command not found

In this troubleshooting guide we learn how to fix bazel command not found error message

Introduction

When you run more command in linux terminal / console, you get the following error message

bazel: command not found

or when using sudo you get the following error message

sudo: bazel: command not found

Solutions to bazel: command not found

How To Fix bazel: command not found in Ubuntu / Debian / Kali Linux / Raspbian

In Ubuntu bazel is provided by bazel-bootstrap package.

bazel-bootstrap is:

Supported build tasks include running compilers and linkers to produce executable programs and libraries, and assembling deployable packages for Android, iOS and other target environments. Bazel is similar to other tools like Make, Ant, Gradle, Buck, Pants and Maven.

This package contains the bootstrap variant of Bazel and should only be used on systems that do not have the full version of Bazel built yet.

To fix this problem, we can install more using the command below.

sudo apt-get -y install bazel-bootstrap

This command might take some time to finish depending on your machine internet connection.

You can also use apt command to install bazel-bootstrap.

sudo apt -y install bazel-bootstrap

Or if you have aptitude installed you can use the following command.

sudo aptitude install bazel-bootstrap

Summary

In this tutorial we learn how to fix bazel command not found error in Ubuntu / Debian / Kali Linux or Raspbian distribution.