How to let `dpkg -i` install dependencies for me?

After using dpkg, running the following command helped me to install the required dependencies:

sudo apt-get -f install

In all, your terminal should look like this:

$ sudo dpkg -i package_with_unsatisfied_dependencies.deb
dpkg: dependency problems prevent ... 
[additional messages]

$ sudo apt-get -f install
[apt messages]
Setting up [dependency]...
Setting up package_with_unsatisfied_dependencies...

Notice the line about Setting up package_with_unsatisfied_dependencies. This fixes (and completes) the installation of package_with_unsatisfied_dependencies.deb.


starting with apt 1.1 (available in Xenial (16.04), stretch) apt install also allows local files:

sudo apt install ./foo-1.2.3.deb

So much simpler and cleaner.

See the release announcment


You can install gdebi-core, which is the command line version of the GDebi package installer from 10.04 and earlier. In the newer versions of Ubuntu, the Software Center is used to install debs, which doesn't have a command line equivalent.

To install a deb package using gdebi, just run:

sudo gdebi my_package_1.0.deb

Tags:

Dpkg