The hardest part of compiling software on Linux is locating its dependencies and installing them. Ubuntu has apt commands that automatically detect, locate and install dependencies, doing the hard work for you.

We recently covered the basics of compiling software from source on Ubuntu, so check out our original article if you’re just getting started.


Auto-apt watches and waits when you run the ./configure command through it. When ./configure tries to access a file that doesn’t exist, auto-apt puts the ./configure process on hold, installs the appropriate package and lets the ./configure process continue.

First, install auto-apt with the following command:

sudo apt-get install auto-apt

Once it’s installed, run the following command to download the file lists it auto-apt requires. This process will take a few minutes.

sudo auto-apt update

After the first command is done, run the following commands to update its databases. These commands will also take a few minutes.

sudo auto-apt updatedb && sudo auto-apt update-local

After your’e done building auto-apt’s databases, you can start the ./configure process with the following command:

sudo auto-apt run ./configure


If you see an error message that says a specific file is missing, you may not know the package you have to install to get the file. Apt-file lets you find the packages that contain a specific file with a single command.

First, you’ll have to install apt-file itself:

sudo apt-get install apt-file

After it’s installed, run the following command to download the file lists from your configured apt repositories. These are large lists, so downloading them will take a few minutes.

sudo apt-file update

Run the following command, replacing “example.pc” with a file name, and the command will tell you exactly which package you need to install:

apt-file search file example.pc

Install the package with the standard apt-get install command:

sudo apt-get install package

You can also perform a file search from the Ubuntu Package Search website. Use the “Search the contents of packages” section on the page to search a specific file.

It’ll give you the same results as apt-file, and you won’t have to download any file lists.

Apt-Get Build-Dep

We covered apt-get build-dep in our initial post. If an earlier version of the program you’re trying to install is already in Ubuntu’s package repositories, Ubuntu already knows the dependencies it requires.

Type the following command, replacing “package” with the name of the packge, and apt-get will install the required dependencies:

sudo apt-get build-dep package

Apt-get prompts you to install all the required dependencies.

If a newer version of the program requires different dependencies, you may have to install some additional dependencies manually.

All these commands use apt-get, so you can also them on Debian, Linux Mint and any other Linux distribution that uses apt-get and .deb packages.

Profile Photo for Chris Hoffman Chris Hoffman
Chris Hoffman is Editor-in-Chief of How-To Geek. He's written about technology for over a decade and was a PCWorld columnist for two years. Chris has written for The New York Times and Reader's Digest, been interviewed as a technology expert on TV stations like Miami's NBC 6, and had his work covered by news outlets like the BBC. Since 2011, Chris has written over 2,000 articles that have been read more than one billion times---and that's just here at How-To Geek.
Read Full Bio »