Removing old packages from yay cache in home directory

Hey there. I use yay -Suy to upgrade all my installed packages. Furthermore I use paccache to only keep the latest 3 packages of all the installations in the /var/cache/pacman/pkg directory and remove the older ones. But it seems that all packages from the AUR installed via yay are stored in a .cache/yay folder in my home directory. They are not removed by paccache.
How can I have them removed automatically?

hi,

paccache dont touch thinks in your own cache directory :slight_smile:

if you do , yay (-Sa) aurPackageXX --cleanafter , it cleans after. if you do yay -Sc answer the first questions with No , but then it ask to remove the yay cache direcory… if you say yes it removes.

1 Like

Thank you!

yay -Scc

Cache directory: /var/cache/pacman/pkg/
:: Do you want to remove ALL files from cache? [y/N] n

Database directory: /var/lib/pacman/
:: Do you want to remove unused repositories? [Y/n] n

Build directory: /home/joe/.cache/yay
==> Do you want to remove ALL AUR packages from cache? [Y/n] y
removing AUR packages from cache...

1 Like
 yay -Yc
[sudo] password for judd: 
comprobando dependencias...

Paquetes (4) go-2:1.13-1  help2man-1.47.11-1  meson-0.51.2-1  ninja-1.9.0-1

Tamaño total quitado:  484,22 MiB

:: ÂżDesea quitar estos paquetes? [S/n] 
:: Ejecutando los «hooks» de preinstalación...
(1/1) Removing old entries from the info directory file...
:: Procesando los cambios de los paquetes...
(1/4) quitando meson                               [######################] 100%
(2/4) quitando ninja                               [######################] 100%
(3/4) quitando help2man                            [######################] 100%
(4/4) quitando go                                  [######################] 100%
:: Ejecutando los «hooks» de posinstalación...
(1/1) Arming ConditionNeedsUpdate...
yay -Ps
Yay version v9.2.0
===========================================
Total installed packages: 912
Total foreign installed packages: 8
Explicitly installed packages: 338
Total Size occupied by packages: 5.9 GiB
===========================================
Ten biggest packages:
linux-firmware: 464.8 MiB
spotify: 272.9 MiB
firefox: 187.9 MiB
chromium: 175.1 MiB
boost: 167.5 MiB
thunderbird: 156.5 MiB
python: 144.5 MiB
gcc: 139.0 MiB
linux-lts: 126.6 MiB
gcc-libs: 116.4 MiB
===========================================
:: Querying AUR...

1 Like

your post reminds me on linking users to the sources!

1 Like

OK. That’s what I did and that’s how it worked. Can you tell me the difference between -Sc and -Scc? I only used the -Sc version but it worked anyway.
Is it possible, to have yay clean say like the oldest packages from your ~/.cache after updating the system? I mean like similar to how paccach does it?

But if you have a program or have a specifik kernel frol aur that is written in c, sometimes ti keep those sources can speed up the build time with ccache. Info https://wiki.archlinux.org/index.php/Ccache. Only programs written in c to keep those in is handy, speedup atleast a bit