Skip to main content

Install Build Essentials in Ubuntu

The build-essential meta package lets you install a number of development tools such as gcc, g++, make etc in Ubuntu.

Sagar Sharma

While installing packages from source, almost every tutorial will instruct you to install build-essentials on Ubuntu.

Sure, there are several reasons why it is so important to install the build-essentials package before installing any package from the source.

So in this tutorial, I will walk you through the following:

  • What is build essentials in Ubuntu
  • How you can install build-essentials in Ubuntu
  • How to remove build essentials from Ubuntu (if required)

Let's start with the first one.

What is the build-essential package in Ubuntu?

As the name suggests, the build-essential package is a meta package, which means it is a set of packages that are essential to building software.

But what are the packages we get in the build-essentials package, you may ask?

Well, here's the list of packages and what are they meant for in the build-essentials package:

  • gcc: the GNU C compiler (can also be used to compile C++ using additional libraries).
  • g++: the GNU C++ compiler.
  • libc6-dev: provides the development libraries and header files for the GNU C Library (glibc).
  • make: used to make software using the instructions from the makefile.
  • dpkg-dev: used to create, distribute, and maintain .deb packages.

In a nutshell, these tools are the most crucial when you want to build packages from the source, and this is the reason why they named the meta package "build-essential".

How to install build-essential in Ubuntu

To install the build-essential package, all you have to do is execute the following command:

sudo apt install build-essential 

To verify the installation, you can check the installed version of GCC (included in the build-essential package) using the following:

gcc --version
Check the installed verison of GCC in Ubuntu

That's it!

How to uninstall build-essential from Ubuntu

Not recommended unless you know what you are up to! It may remove some important packages that are needed by other tools.

To remove packages from Ubuntu, you use the apt-remove, and the same goes for removing build-essential.

You can use the following command to remove build-essential from Ubuntu:

sudo apt purge --auto-remove build-essential

That's it!

More on GCC

Once you install GCC, you may want to compile and run C programs. For that, you can refer to our detailed tutorial on how to compile and run C programs:

Running C Programs in Ubuntu Command Line
This short tutorial explains about the execution of C programs in Ubuntu, with the help of a compiler like gcc.

Here's how to use the g++ to compile the C++ program:

How to Install g++ in Ubuntu
g++ is used to compile code and in this tutorial, you will learn how you install g++ in Ubuntu.

I hope you will find this guide helpful.

Sagar Sharma