Synopsis

yaycache <operation> [options] [target …]

Description

yaycache removes old packages from the yay cache directory. By default the last three versions of a package are kept.

Operations

-d, --dryrun

Perform a dry run, only finding candidate packages.

-m, --move <dir>

Move candidate packages from the cache directory to dir.

-r, --remove

Remove candidate packages from the cache directory.

Options

-a, --arch <arch>

Scan for packages for a specific architecture. Default is to scan for all architectures.

-c, --cachedir <dir>

Specify a different cache directory. This option can be used more than once. The default config directory is $XDG_CACHE_HOME/yay/*/. If $XDG_CACHE_HOME is unset, the config directory will fall back to $HOME/.cache/yay/*/

-f, --force

Apply force to mv and rm operations.

-h, --help

Display syntax and command-line options.

-i, --ignore <pkgs>

Specify packages to ignore, comma-separated. Alternatively "-" can be used to read the package names from stdin, newline-delimited.

-k, --keep <num>

Specify how many versions of each package are kept in the cache directory, default is 3.

--remove-build-files

Remove package source build files in cache directory: the files git reports as untracked in the AUR clone. A cache directory that is not the top of a git clone is skipped with a warning, since from anywhere else git would report the contents of an enclosing repository instead.

--remove-uninstalled-dirs

Remove the whole cache directory of a package that is no longer installed (the AUR clone with its PKGBUILD, .git, sources and built packages), instead of only its old built packages and build files. Requires -u. A directory is removed when none of the packages it builds (read from its .SRCINFO, ignoring names makepkg(8) would reject, falling back to the directory name) is installed or ignored, and, if --min-atime or --min-mtime is given, when nothing in it has been accessed or modified since then. --keep does not apply to these directories. With -m the directory is moved instead.

--min-atime <time>
--min-mtime <time>

Keep packages with an atime/mtime that is not older than the time given, even if this means keeping more than specified through the --keep option. Accepts arguments according to info "Date input formats", e.g. 30 days ago.

--nocolor

Do not colorize output.

-z, --null

Use null delimiters for candidate names (only with -v and -vv).

-q, --quiet

Minimize the output.

-u, --uninstalled

Target uninstalled packages.

-v, --verbose

Increase verbosity, can be specified up to 3 times.

-V, --version

Display version information.

Exit Status

0 on success. 1 when an option is invalid, an operation fails, or a cache directory could not be scanned: such a directory is reported and skipped, and the others are still processed.

Systemd Timer

The package cache can be cleaned periodically using the systemd user timer yaycache.timer. If the timer is enabled the cache will be cleaned weekly by yaycache.service, which runs yaycache -r $YAYCACHE_ARGS.

Additional options are read from the YAYCACHE_ARGS variable in /etc/yaycache.conf, or in $XDG_CONFIG_HOME/yaycache.conf (~/.config/yaycache.conf) which takes precedence. For example, to keep one version of each package and also remove build files older than a month:

YAYCACHE_ARGS="-k1 --remove-build-files --min-mtime '30 days ago'"

The unit itself can still be customised with systemctl --user edit yaycache.service.

Bugs

Bugs can be reported through github: https://github.com/aokellermann/yaycache/issues/new.

Authors

Current maintainers:

For additional contributors, use git shortlog -s on the yaycache.git repository.