Install a local .deb file with its dependencies

Sometimes, I have to install a local .deb package. When doing so, it happens that I miss some required dependencies. When using dpkg -i mypackage.deb, it fails for each missing dependency, making it a tedious task to install each of them.

I just found out that apt is capable of installing a local package with its dependencies, when using the following command:

sudo apt install --fix-broken ./package.deb

# Or it's smaller form
sudo apt install -f ./package.deb

Published on 2025-11-12 #debian - In code