ocamlbuild command not found

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

Introduction

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

ocamlbuild: command not found

or when using sudo you get the following error message

sudo: ocamlbuild: command not found

Solutions to ocamlbuild: command not found

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

In Ubuntu ocamlbuild is provided by ocamlbuild package.

ocamlbuild is:

OCamlbuild is a generic build tool, which has built-in rules for building OCaml libraries and programs.

It was distributed as part of the OCaml distribution for OCaml versions between 3.10.0 and 4.02.3. Starting from OCaml 4.03, it is now released separately.

Its job is to determine the sequence of calls to the compiler with the right set of command-line flags needed to build your OCaml-centric software project.

It was designed as a generic build system (it is in fact not OCaml-specific), but also to be expressive enough to cover the specifics of the OCaml language that make writing good Makefiles difficult, such as the dreaded “units Foo and Bar make inconsistent assumptions about Baz” error.

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

sudo apt-get -y install ocamlbuild

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

You can also use apt command to install ocamlbuild.

sudo apt -y install ocamlbuild

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

sudo aptitude install ocamlbuild

Summary

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