LinuxReviws.org --get your your Linux knowledge
> Linux Reviews > Gentoo Linux >

USE flags explained: How Gentoo configures software

Gentoo Linux gives allows you to control how, and with what support, programs are installed by using USE flags to describe how software should be installed.


  1. The basics of USE flags
  2. Setting pr. package USE flags
  3. gentoolkit allows you to view previously used settings
  4. ufed - the use flag editor
  5. Alphabetical list of Gentoo USE flags


Open Source means program code can and will be reused. If there is an existing software library that does a job excellent then it is obvious most developers, lazy as they are, will choose to link against it instead of doing it all over from scratch.

Most programs support a large amount of other programs and libraries. Some are required by all, like glibc, others are optional.

Gentoo Linux compiles all your software from source, unlike distributions like Mandrake, Debian, Suse and Redhat who provide ready to use compiled packages (called deb and rpm). Installing software from source takes much longer, but gives you much more control over how things are installed.

1. The basics of USE flags

A software package can be configured and compiled in many ways. An audio application may support many formats, but you may not want or need all of them. Portage uses a variable called 'USE' to control how packages are installed. These are set system-wide in /etc/make.conf, and dictate how packages are installed.

A description of most USE flags are available in the file /usr/portage/profiles/use.desc

The standard settings for your USE flags are available in /etc/make.profile/use.defaults

USE flags are set with flag (not +flag) you want and -flag you don't want.

1.1. Example

The GNU Midnight Commander can be compiled with and without support for gpm (Console-based mouse driver), nls (Native Language Support using gettext), samba (suite of SMB and CIFS client/server programs), ncurses (a console display library), X (xfree) and slang (a text display library).

You can use the -p (--pretend) parameter to view a packages USE flags and depending packages that would be installed without actually installing anything:

emerge -pv package

For MC (app-misc/mc) this may give you the output:

[ebuild U ] app-misc/mc-4.6.0-r2 [4.6.0-r1] +gpm +nls -samba +ncurses +X +slang

If this is not desired and you want MC installed with samba support and without X support you can change the USE= line in /etc/make.conf to USE="samba -X. This would change the output of emerge -pv MC to

[ebuild U ] app-misc/mc-4.6.0-r2 [4.6.0-r1] +gpm +nls +samba +ncurses -X +slang

2. Setting pr. package USE flags

You may want system-wide support for X, but do not want MC linked against it. This can be done by setting the flag before the emerge command when installing it:

USE="-X" emerge mc

Be aware that flags set this way are not stored anywhere, if MC is recompiled during a emerge -u world later the system wide settings will be used.

2.1. Make your USE flags permanent on a pr. package basis in /etc/portage/package.use

The configuration file /etc/portage/package.use allows you to set pr. package USE flags. You must create this folder yourself as it is not done for you. The file should contain category/package thisflag -thatflag. Example:

  x11-base/xfree -ipv6
  app-misc/mc -X gpm

Flags configured in /etc/portage/package.use override flags set in /etc/make.conf for the packages listed.

3. gentoolkit allows you to view previously used settings

etcat (manpage) and qpkg (manpage) are two great portage tools included in the package gentoolkit.

To view all USE flags affecting a package, how they are currently set and used if you (re)emerge and what flags were used the last time the package was compiled:

etcat -u package

etcat is generally a very powerfull tool.

4. ufed - the use flag editor

ufed (emerge ufed) is a use flag editor (manpage). It lists all available USE flags and lets you select which you want easily.

ufed saves your choices to /etc/make.conf.

5. Alphabetical list of Gentoo USE flags

Meet new people