emerge — configuration — ebuild repository — dispatch-conf
world file — USE flags — ebuilds — profiles
upgrades — using testing packages — binary packages
tools — gentoolkit — eselect
Portage FAQ — cheat sheet — FAQ
USE flags are keywords that embody support and dependency-information for a certain concept. They are a core feature of Gentoo, and a good understanding of how to deal with them is needed for administering a Gentoo system.
USE flags serve to configure Portage to determine how each package will be configured on installation or update. USE flags can configure many aspects of a package, and the available USE flags and corresponding optional functionality depend on each individual piece of software. They often set compile time options, or what associated optional libraries or utilities will be linked with a package.
This ability to choose options only available when installing a package is one of the great advantages Gentoo leverages from being source based.
The whole distribution comes with reasonable USE flags by default, and these are further refined by selecting a profile to suit planned system usage. Packages each have their own set of available USE flags, depending on what can be configured for the package, and these are also set to reasonable defaults.
Declaring USE flags
Technically, the Gentoo ebuild repository comes with a small set of default USE flags. Default USE flags are further defined by the selected profile. Each package comes with a set of available USE flags, and these can also have a default state, if this is justified in the context of the package. Each layer overrides the previous, to configure Portage to set up the installation of each package.
The presence of a USE flag in one of these files will set that USE flag. Including a USE flag preceded by a minus sign ("-") will unset that USE flag. If a USE flag is not present in one of these places, the default will be used.
It is often preferable to set USE flags per package rather than system wide. Use flag defaults are usually set to a sane default - carefully consider what flags to set globally in make.conf.
A USE flag may be temporarily set on the command line to check what effect it will have on dependencies, before writing it to /etc/portage/package.use:
USE="[USE flag to test]" emerge --pretend --verbose <package name>
To see which USE flags are presently enabled:
portageq envvar USE | xargs -n 1
To check if a certain USE flag is activated and which packages use it, run:
euse -I <use_flag> # included with app-portage/gentoolkit
quse <use_flag> # included with app-portage/portage-utils
eix --installed-with-use <use_flag> # included with app-portage/eix
<use_flag> with the USE flag to be checked.
Emerge command options
The emerge command has some USE flag related options like:
--complete-graph-if-new-use < y | n >
For details see man 1 emerge.
"Local" vs "global" USE flags
The technical difference between "local" and "global" flags is simply a difference of where their descriptions are saved in the ebuild repository. "Global" USE flags are described in use.desc files (example) for a whole profile, whereas "local" USE flags are described in metadata.xml files (example), for a single package. When deciding where to define them, developers determine if a USE flag has a general function common to several packages, or a specific function for a single package.
For the end user, whether a USE flag is "global" or "local" has little importance. "Global" flags may sometimes be more suited to being set in the USE variable in make.conf, but there is absolutely no hard rule. In any case, as much as possible, no USE flags should be set in make.conf unless necessary, and /etc/portage/package.use should be preferred to set USE flags on a per-package basis. Following this advice should ease system administration in the long run.
Some tools are available for analyzing and managing USE flags:
- quse - for details see man 1 quse
- equery hasuse (USE flag)
- equery uses (package name)
- eix - See
- /etc/portage/package.use — provides a more fine grained per-package control of USE flags than the USE variable in /etc/portage/make.conf
- Gentoo Handbook documentation on USE flags
- Gentoo Java USE flags
- Toolkit USE Flags — summarizes main points from discussions about toolkit (GTK, QT) USE flags (gtk2, gtk3, qt4, qt5, etc.).
- https://packages.gentoo.org/useflags - USE flags on Gentoo Packages Database.
- cat /var/db/repos/gentoo/profiles/use.desc - The common USE flag description list can be seen locally on systems with Portage installed.
- https://www.gentoo.org/support/use-flags/ - The full USE flag index.
- https://devmanual.gentoo.org/general-concepts/use-flags/ - USE flags conceptually explained in the Gentoo Developer Handbook.