Problems clearing yay's cache with a shell

hello, i’m having some problems clearing yay’s cache

first, I learn that yay has its own cache. I thought it was using pacman’s cache …

I discovered that yay’s own cache had reached 5 GB on my small disk.

Yet I was clearing it (or so I thought) regularly by using yay -Sc in my monthly cleanup script.

After some research, it seems that the yay -Sc command only works in interactive mode. As It didn’t get any response from me, my shell never cleared the cache, obviously…

Is there a way to clear the yay cache with yay in a non-interactive way? Or will I have to use pacman exclusively for this… As I also use the AUR repository, I couldn’t do without it completely…

thanks for your answers.

yay’s cache i believe is found in ~/.cache folder. You should just be able to rm -rf ~/.cache

Cache Yay:

Cache Paru:

Cache Pacman:

You will be able to clear the folder as thefrog said. Only he showed an example of the entire cache, and not specifically the assistant.

The command that will most likely work for you is:
rm -rf ~/.cache/yay/

thanks to you, I’ve seen this directory (thanks to the excellent ncdu :-), and rm, that’s what I would have done.

strange that yay has its own cache and only acts interactively with this option. I’ll change my shell, I thought it was all in the pacman cache, unless yay’s cache only contains AUR-related packages? Didn’t look.

no, for two reasons,

rm -rf ~/.cache/yay/

deletes yay directory it should be left untouched.

rm -rf ~/.cache/yay/*


~ refers to the home of the curent user which at this moment is sudo user , so it must be run before sudo command i think

You are pretty much doing the same things with both commands. The yay directory will simply be newly created if needed. Sudo is not needed inside the users home directory.

I add this to my fstab on all my installs which cleans out the cache on shut down. Mainly used to clean mozilla folder and all the google crap.

# grep cache /etc/fstab
tmpfs		/home/sam/.cache	tmpfs	uid=1000,gid=1000,mode=750 0 0

hi, In

ok, i thought yay wouldn’t be recreated, what contains this directory ? It this juste for AUR builds works ?

Sudo is not needed inside the users home directory. indeed but it follows a snapper + upgrade commands which must be run with sudo so therefore rm inherits the sudo in this case, sorry for this misunderstand… :wink:

@sammiev seems to be a good idea if nothing critical/essential in that dir…

No its not strange at all. Yay and other aur helpers are run by user privileges and not Root. You only give root the install.