Ubuntu – How to let `dpkg -i` install dependencies for me

dpkg

Say, I have foo-1.2.3.deb which depends on perl and python, however, running command:

dpkg -i ./foo-1.2.3.deb

won't install these dependencies. So I must apt-get install perl python by hand.

How to make dpkg -i install these dependencies for me automatically?

Best Answer

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.