On this page
Gentoo Package Management Handbook
Portage is Gentoo's package management system. Core concepts: ebuild (build script), emerge (CLI), USE flags (compile-time feature switches), world set (packages explicitly installed by the user), @system (base system set).
Status Checks
# Installed packages
# Package information
# Check for updates
&&
# USE flags
|
# World set
# Dependency analysis
Installation and Uninstallation
# Installation
# Uninstallation
# Updates
# Install from overlay
# Download only, do not install
USE Flags Management
# Temporarily enable/disable (single emerge)
USE="gtk -qt5"
# Package-level USE (permanent)
# Edit /etc/portage/package.use/<name> or /etc/portage/package.use
# Global USE (permanent)
# Edit /etc/portage/make.conf:
# USE="gtk -qt5"
# View which packages are affected by a USE flag
# Rebuild affected packages after USE flag changes
Keywords and Masking
# Accept ~amd64 (testing) for specific packages
# Accept specific version
# Accept ** (all keywords, including live ebuilds)
# Mask (prevent installation/upgrade)
# Unmask (remove global mask)
Configuration Updates (dispatch-conf)
# If prompted for CONFIGURATION FILES update after emerge:
# Shortcuts: u=use-new, z=zap-new (discard new config), m=merge-interactive, q=quit
# View pending configurations
# Automation (non-interactive)
Troubleshooting and Maintenance
# Synchronization
# Fix broken dependencies
# Rebuild @world (after major version upgrades)
# After Python target upgrade
# Cleanup
# View build logs
# Check system consistency
# Check overlay issues
|
# If overlays like guru cause conflicts, temporarily disable:
# emerge -avuDN @world --exclude="*::guru"
Overlay Management
# List enabled overlays
|
# Add overlay (eselect-repository)
# Synchronize overlay
Profile and Compiler
# Profile switching
# GCC version switching
# Python version
# View compilation environment
Quick Reference: Key make.conf Configurations
# Key items in /etc/portage/make.conf:
# MAKEOPTS="-j16" # Number of parallel compilations (≈ number of CPU cores)
# EMERGE_DEFAULT_OPTS="--jobs=4 --load-average=16" # Parallel emerge tasks
# ACCEPT_LICENSE="*" # Accept all licenses (use with caution in production)
# L10N="en-US zh-CN" # Localization
# VIDEO_CARDS="amdgpu radeonsi" # Graphics drivers
# INPUT_DEVICES="libinput" # Input devices
# CPU_FLAGS_X86="aes avx avx2 ..." # Compiler optimizations (cpuid2cpuflags)