LinuxCommandLibrary

emerge

Install, update, and manage software packages

TLDR

Synchronize all packages

$ sudo emerge --sync
copy

Update all packages, including dependencies
$ sudo emerge [[-avuDN|--ask --verbose --update --deep --newuse]] @world
copy

Resume a failed update, skipping the failing package
$ sudo emerge --resume --skipfirst
copy

Install a new package, with confirmation
$ sudo emerge [[-av|--ask --verbose]] [package]
copy

Remove a package and its dependencies with confirmation
$ sudo emerge [[-avc|--ask --verbose --depclean]] [package]
copy

Remove orphaned packages (installed as dependencies but no longer required by any package)
$ sudo emerge [[-avc|--ask --verbose --depclean]]
copy

Search the package database for a keyword
$ emerge [[-S|--searchdesc]] [keyword]
copy

SYNOPSIS

emerge [options] [action] [package(s)...]
Common actions include:
  emerge package-name (install/update)
  emerge --sync (update Portage tree)
  emerge --update --deep --newuse @world (full system update)
  emerge --unmerge package-name (remove package)
  emerge --search keyword (search packages)

PARAMETERS

--sync, -s
    Updates the local Portage tree, fetching new ebuilds and changes.

--update, -u
    Updates installed packages to their latest available versions.

--deep, -D
    When used with --update, also checks dependencies of dependencies for updates.

--newuse, -N
    Forces a rebuild of packages where USE flags have changed.

--pretend, -p
    Performs a dry run, showing what actions emerge would take without actual changes.

--ask, -a
    Prompts for confirmation before proceeding with any changes.

--unmerge
    Removes specified installed packages from the system.

--depclean, -c
    Removes orphaned packages (dependencies no longer required by any installed software).

--search, -S
    Searches the Portage tree for packages matching a keyword.

--info
    Displays detailed information about specified packages.

--noreplace
    Skips installing a package if it is already installed.

--oneshot
    Installs a package without adding it to the world file (for temporary dependencies).

--verbose, -v
    Increases the verbosity of the output, showing more details.

--quiet, -q
    Suppresses most output, showing only critical messages.

--autounmask-write
    Attempts to automatically write entries to necessary configuration files (e.g., package.use, package.accept_keywords) to satisfy dependencies.

--jobs, -j
    Specifies the number of parallel compilation jobs.

DESCRIPTION

emerge is the primary command-line interface to the Portage package management system on Gentoo Linux.
Unlike binary-based package managers, emerge typically compiles packages from source code, offering unparalleled flexibility and optimization for specific hardware. It handles dependency resolution, downloads source code, applies patches, compiles, and installs software.
Users can customize builds extensively using USE flags, which enable or disable specific features within packages. emerge also manages system updates, package removal, and synchronization with the official Gentoo Portage tree, ensuring the system stays current and optimized. Its design allows for a highly customized and performant system tailored to individual needs.

CAVEATS

Due to source compilation, emerge operations can be time-consuming, especially for large packages or on slower hardware. It also requires significant disk space for source code and build artifacts.
Managing USE flags and masks can initially be complex for new users, requiring a steeper learning curve compared to binary package managers.

<I>USE FLAGS</I>

USE flags are keywords that control conditional features of packages during compilation. They allow users to customize software by enabling or disabling specific functionalities (e.g., GUI support, specific database drivers, optional libraries), leading to a leaner and more optimized system tailored to individual needs.

<I>THE @WORLD SET</I>

The @world set is a special package set that represents all packages explicitly installed by the user. Running emerge --update --deep --newuse @world ensures that all user-selected applications and their dependencies are updated, rebuilt if necessary due to USE flag changes, and maintained.

HISTORY

emerge emerged as the primary frontend for the Portage package management system, which was originally created by Daniel Robbins, the founder of Gentoo Linux, around 1999-2000. It was heavily inspired by the FreeBSD Ports system, adapting its source-based approach to a Linux environment.
Since its inception, emerge has been central to Gentoo's philosophy of offering ultimate flexibility and control over the software stack, evolving with the project to manage increasingly complex dependency trees and build options. Its stability and powerful features have made it a cornerstone of the Gentoo experience.

SEE ALSO

portage(5), ebuild(5), make.conf(5), package.use(5), eselect(1)

Copied to clipboard