From LQWiki
Jump to navigation Jump to search

Emerge is the traditional, and the simplest, command-line interface to Gentoo's Portage system. Given a package name, emerge will find the latest available version that satisfies the settings in make.conf, and install it, along with any dependencies it requires.

Common usage

If it is more than a couple of days since you last did, run:

# emerge --sync

before using the commands below. This will use rsync to updadte your portage tree. If this command fails due to a firewall try:

# emerge-webrsync

All the install commands lists the USE flags that affects the emerge; if any sound useful add them to /etc/make.conf

  • Find package: emerge -S keywords
  • Install new package quickly: emerge -av package-name
  • Install new package, upgrading dependencies: emerge -auDv package-name
  • Upgrade all packages: emerge -auDv world

To clean up unwanted packages from the system, it is usually easiest and cleanest to use this approach.

nano -w /var/cache/edb/world  # Remove anything you don't want anymore
emerge depclean -a # Check for sanity. This is important. 
rm -f ~/.revdep*
revdep-rebuild -a

Common command-line options

Emerge can accept a number of common command-line switches, including:

  • -p (--pretend): Given the -p switch, emerge will simply calculate package dependencies, and output a list of packages that would be installed. This is particularly useful if you are unfamiliar with a particular package, and want to know what dependencies it has. This flag can be used together with almost any others (e.g. emerge -uDp world).
  • -f (--fetchonly): This causes emerge to download the source code for a package and its dependencies, without compiling or installing it.
  • -s (--search): With this option, emerge will search the Portage tree for any packages whose names contain the given string (e.g. emerge -s xfree will return x11-base/xfree, x11-base/xfree-drm, and games-board/xfreecell).
  • -u (--update): This causes emerge to upgrade the given package to the latest version, also updating its dependencies. This is often used together with the world keyword, updating every package that you have installed.
  • -D (--deep): When used together with -u, -D will cause emerge to update all packages in the package's dependency tree, and not just its immediate dependencies (that is, it searches the package's immediate dependencies, then their dependencies, and so on). Again, this is often used in emerge -uD world.
  • -v (--verbose): increases the amount of information outputted by emerge. Most usefully lists which USE flags are enabled for a packages compilation, and the total size of files to be downloaded. Used in conjuction with -a or -p.

See also