I would like to exclude specific packages from installation with apt-get, that is, install a metapackage without the list of specific packages, preferably with one invocation of apt-get.

For example, in Ubuntu 14.04 LTS command-line, I am installing MATE desktop environment. In 14.04 LTS MATE is not an official flavour, so I'm adding a PPA:

sudo apt-get install software-properties-common # need them for 'apt-add-repository'
sudo apt-add-repository ppa:ubuntu-mate-dev/ppa
sudo apt-add-repository ppa:ubuntu-mate-dev/trusty-mate
sudo apt-get update

then installing:

sudo apt-get install xorg mate-core --no-install-recommends

Even without the recommended extras, mate-core installs 3 terminal emulators: xterm, uxterm and mate-terminal , the latter lacking proper fonts while installed in this minimal configuration.

Suppose I decide that 3 terminal programs would be too many and I'd like to install xorg and mate-core without xterm and mate-terminal. I could do

sudo apt-get install xorg mate-core --no-install-recommends
sudo apt-get purge xterm mate-terminal

but is it possible to do this in one go? Is there some syntax like

sudo apt-get install xorg mate-core --without xterm mate-terminal
  • Are you sure you can remove xterm and mate-terminal? In 15.04, mate-terminal is a hard dependency of mate-desktop-environment-core, which is a hard dependency of mate-core, and I suppose the PPA mate-terminal doesn't provide x-terminal-emulator (which the package in 15.04 does).
    – muru
    May 10 '15 at 20:35
  • Maybe you're right, unless an asterisk next to package names means something special here. Also, surprisingly little space is going to be freed. Anyway, my question is about removing whatever can be removed, say, XTerm and maybe UXTerm (I'm not sure what package name for the latter is) May 10 '15 at 20:42
  • 1
    Is this what you are looking for? askubuntu.com/questions/75895/…
    – Seth
    May 20 '15 at 22:55
  • @Seth Not quite: I would like if there would be some syntax like sudo apt-get install xorg mate-core --without xterm mate-terminal May 20 '15 at 23:16
  • If you use aptitude (or some graphical package manager), you can (de)select which packages to install, and if one results in a broken dependency, an explanation will (usually) be given. May 20 '15 at 23:21

So, mate-core depends on mate-desktop-environment-core which in turn depends on mate-terminal. A depend cannot be broken easily. Nor apt-get nor aptitude supports a --without or --exclude option and "holding" the packages won't help:

$ echo "mate-terminal hold" | sudo dpkg --set-selections
$ sudo apt-get install mate-core
Some packages could not be installed...
The following packages have unmet dependencies:

Sure, one can use dpkg --force-depends to install a package, but that's maybe not what you want.

A possibility would be to fullfill the Depends: flag with a dummy package:

$ sudo apt-get install equivs
$ equivs-control mate-terminal
$ vi mate-terminal
Section: misc
Priority: optional
Standards-Version: 3.9.2
Package: mate-terminal
Version: 1.8.0
Description: Dummy package for mate-terminal

$ equivs-build mate-terminal
$ sudo dpkg -i mate-terminal_1.8.0_all.deb

Now mate-core should be able to install w/o mate-terminal. Repeat the same for other packages to be excluded.

Admittedly this is quite an effort and a --without option would be nice. Maybe a wishlist bug can be opened to provide such functionality in the future, but I somehow doubt that this will be implemented.

However, a more realistic option would be to petition the PPA owner to provide another meta package for MATE with lesser Depends packages set.


If you use aptitude or a graphical package manager (Synaptic, etc.), then you can unselect which packages should be installed as long as it doesn't cause a dependency issue.

In the case of aptitude, before installing a package (in the graphical view), it will show you why a dependent package is being installed. In my case, I use KDE, and so don't have any MATE packages. If I tell it to install mate-core, I get the following:

enter image description here

Notice that mate-core is marked as being manually installed, and many other packages are being installed. For the mate-terminal package, in the bottom, it says, "mate-desktop-environment-core [universe] depends on mate-terminal (>= 1.0.0)". Going over to the entry for mate-desktop-environment-core,

enter image description here

"mate-core [universe] depends on mate-desktop-environment-core (>= 1.8.0+9)". This is why mate-terminal is being installed.

If, instead, a recommended package is being installed (rather than something that is dependent on another package), aptitude will tell you so, and you can tell it not to install that package without any broken dependencies. For example:

enter image description here


There's a special apt syntax for scenarios like this: appending a hyphen (minus sign) to a package will remove/not install it, so the closest to your sudo apt-get install xorg mate-core --without xterm mate-terminal is sudo apt-get install xorg mate-core xterm- mate-terminal- (spotted on https://askubuntu.com/a/1011439/182923)

It will not help in this case, as you will run into

The following packages have unmet dependencies:
 mate-desktop-environment-core : Depends: mate-terminal (>= 1.20) but it is not going to be installed                                                                        
E: Unable to correct problems, you have held broken packages.

but it seems to be the answer to your specific question. So for reference, this cross-post.


Another method

Download main package which depend on the other. Extract the package, remove the unwanted dependencies, repack it. Now open the new package with gdebi package installer. It will install new dependencies for you.

  • List of depencies can be found at DEBIAN /control -> depends
  • For help on repacing deb see my answer on how to create a PPA

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.