Gentoo Wiki


This article is part of the Tips & Tricks series.
Terminals / Shells Network X Window System Portage System Filesystems Kernel Other

One of my biggest problems when upgrading to the latest KDE is unmasking lots and lots of packages. This article will help you use grep and awk to mask or unmask packages.


Use this command to mask or unmask your package:

File: /etc/portage/package.mask
ACCEPT_KEYWORDS="~x86" emerge -p =PackageName|awk '/ebuild/{print "<greater or less than symbol>" $4}' >> /etc/portage/package.unmask (or mask)

Here's an example to unmask every KDE package that is less than 3.5.0:

File: /etc/portage/package.mask
ACCEPT_KEYWORDS="~x86" emerge -p =kde-meta-3.5.0|awk '/ebuild/{print "<" $4}' >> /etc/portage/package.unmask

Change the file, package names and greater or less than symbols to get the job done.

(Special thanks to dli on #gentoo for the command)

Apply this Idea to other things!

-- 02:22, 10 June 2006 (UTC)

When emerging ~* packages, it can be very fustrating to have to worry about masked deps all the time. Using

"ACCEPT_KEYWORDS" isn't a good idea, since an emerge -u would downgrade those packages.

Here is what I used to emerge the ~x86 version of gnome, and all the dependencies

File: /etc/portage/package.keywords
ACCEPT_KEYWORDS="~x86" emerge -p =PackageName|awk '/ebuild/{print ">=" $4 " ~x86" }' >> /etc/portage/package.keywords

The exact commands I used to emerge gnome

File: /etc/portage/package.keywords
ACCEPT_KEYWORDS="~x86" emerge -p =gnome|awk '/ebuild/{print ">=" $4 " ~x86"}' >> /etc/portage/package.keywords
emerge -va gnome
Retrieved from ""

Last modified: Wed, 26 Dec 2007 15:37:00 +0000 Hits: 8,248