Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

On the apt-get man's page, one can find this:

install pkg(s)
This option is followed by one or more packages desired for installation. Each package is a package name, not a fully qualified filename (for instance, in a Fedora Core system, glibc would be the argument provided, not glibc-2.4.8.i686.rpm).
All packages required by the package(s) specified for installation will also be retrieved and installed.

build-dep source_pkg
Causes apt-get to install/remove packages in an attempt to satisfy the build dependencies for a source package.

It sonds like both of those are trying to satisfy dependencies, but I had different results while installing matplotlib with each of those: apt-get intall didn't work with my subsequent pip install matplotlib in my virtualenv, while apt-get build-dep did*.

* Yeah, I needed to install matplotlib in a venv, but pip couldn't resolve some of the dependencies, so I lazily used apt in order to solve it

share|improve this question

2 Answers 2

up vote 9 down vote accepted

The short version.

apt-get install

installs a new package, automatically resolving and downloading dependent packages. If package is installed then try to upgrade to latest version.

apt-get build-dep

Causes apt-get to install/remove packages in an attempt to satisfy the build dependencies for a source package.

The command sudo apt-get build-dep packagename means to install all dependencies for 'packagename' so that I can build it". So build-dep is an apt-get command just like install, remove, update, etc.

The build-dep command searches the local repositories in the system and install the build dependencies for package. If the package does not exists in the local repository it will return an error code.

For installing matplotlib see To Install matplotlib on Ubuntu

Source:ManPage & Ravi Saive

share|improve this answer
The OP is asking: What's the difference between apt-get install and apt-get build-dep? So, from a learning perspective, what's wrong with the answer? :) –  Mitch Jul 26 '13 at 13:20

The difference is whether the dependencies are needed at runtime as opposed to at buildtime.

For instance, maybe I'm building a binary which uses openssl. At build time I would need the openssl header files, which are in libssl-dev. I would then list this as a Build-Depends.

However, the resulting binary and package don't need the header and other development files, so at install time I don't need libssl-dev. It wouldn't be in Depends, then. But libssl, the runtime library my binary linked against, would need to be in Depends.

The man sections you quoted indicate this (it talks about "satisfy the build dependencies" of a package), but without prior knowledge of when Build-Depends are used, this can be confusing.

Have a look at the Debian policy guide for definitions of control file fields:


here's the section on Build-Depends. Note it's under the "dependencies for source packages" header:


And this one talks about Depends. Note its' under the Binary packages header:


share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.