I am trying to download some debian packages and their dependencies in a directory.

I tried using the command aptitude download <package_name> it downloaded the package without its dependencies.

How do I tell it to download the dependencies too?

  • This seems to be a duplicate of this. Will the accepted answer work in your case? – maulinglawns Sep 29 '16 at 6:35

You can use apt-rdepends to build the complete set of dependencies (recursively), including the main package, then download that:

apt-get download $(apt-rdepends "${package}" | grep -v ^\ )

(replacing "${package}" of course).


A rather hackish way to do that is to have another utility (apt-cache in this example) list the package's dependencies:

# PACKAGE=nautilus; aptitude download $PACKAGE $(apt-cache depends "$PACKAGE" | grep Depends | awk -F ': ' '{print $NF}' | xargs)

Easier Way

aptitude -d -o Dir::Cache:archives=/home/alex/aptitude-test/ install alsaplayer for exampel.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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